Skip to content

Commit e6d0539

Browse files
committed
Fix logger
1 parent cf36e34 commit e6d0539

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

examples/utils/logger.h

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
const char LOG_INT[] PROGMEM = "%d";
1010

11-
void info(const char *message, bool newLine = TRUE)
11+
void info(const char *message, bool newLine = true)
1212
{
1313
File file = SD.open(LOG_FILE, FILE_WRITE);
1414
if (file)
@@ -19,12 +19,18 @@ void info(const char *message, bool newLine = TRUE)
1919
newLine ? Serial.println(message) : Serial.print(message);
2020
}
2121

22-
void info(const __FlashStringHelper *message, bool newLine = TRUE)
22+
void info(const __FlashStringHelper *message, bool newLine = true)
2323
{
24-
return info((const char *)message, newLine);
24+
File file = SD.open(LOG_FILE, FILE_WRITE);
25+
if (file)
26+
{
27+
newLine ? file.println(message) : file.print(message);
28+
file.close();
29+
}
30+
newLine ? Serial.println(message) : Serial.print(message);
2531
}
2632

27-
void info(long message, bool newLine = TRUE)
33+
void info(long message, bool newLine = true)
2834
{
2935
char buffer[10];
3036
// Use sprintf instead of overrided Serial.print in order to

0 commit comments

Comments
 (0)