Allow logging without logfile
This commit is contained in:
parent
0754aa692b
commit
afd187acc3
1 changed files with 2 additions and 5 deletions
7
log.cpp
7
log.cpp
|
@ -56,10 +56,7 @@ void closelog()
|
||||||
|
|
||||||
void dolog(const log_level_t ll, const char *fmt, ...)
|
void dolog(const log_level_t ll, const char *fmt, ...)
|
||||||
{
|
{
|
||||||
if ((ll < log_level_file && ll < log_level_screen) || !logfile)
|
if (!lfh && logfile != nullptr) {
|
||||||
return;
|
|
||||||
|
|
||||||
if (!lfh) {
|
|
||||||
#if !defined(ESP32)
|
#if !defined(ESP32)
|
||||||
lfh = fopen(logfile, "a+");
|
lfh = fopen(logfile, "a+");
|
||||||
if (!lfh)
|
if (!lfh)
|
||||||
|
@ -96,7 +93,7 @@ void dolog(const log_level_t ll, const char *fmt, ...)
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
|
|
||||||
#if !defined(ESP32)
|
#if !defined(ESP32)
|
||||||
if (ll >= log_level_file)
|
if (ll >= log_level_file && lfh != nullptr)
|
||||||
fprintf(lfh, "%s%s\n", ts_str, str);
|
fprintf(lfh, "%s%s\n", ts_str, str);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue