Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 21 additions & 3 deletions src/ArduinoLog.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,25 @@ typedef void (*printfunction)(Print*, int);
#define LOG_COLOR_WHITE "\033[;37m"
#define LOG_COLOR_BLACK "\033[;38;5;240m"
#define LOG_COLOR_END "\033[0m"

#ifndef ARDUINOLOG_DISABLE_LINE_END_DEFINES
#ifndef CR
#define CR "\n"
#else
#warning "CR already defined"
#endif
#ifndef LF
#define LF "\r"
#else
#warning "LF already defined"
#endif
#ifndef NL
#define NL "\n\r"
#else
#warning "NL already defined"
#endif
#endif

#define LOGGING_VERSION 1_0_4

/**
Expand Down Expand Up @@ -107,6 +123,8 @@ typedef void (*printfunction)(Print*, int);

class Logging {
public:
static constexpr char lineEnd[] = "\n";

explicit Logging();

/**
Expand Down Expand Up @@ -374,7 +392,7 @@ class Logging {

void printFormat(const char format, va_list *args);

template <class T> void printLevel(int level, bool cr, T msg, ...) {
template <class T> void printLevel(int level, bool newLine, T msg, ...) {
#ifndef DISABLE_LOGGING
if (level > _level) {
return;
Expand Down Expand Up @@ -428,8 +446,8 @@ class Logging {
}
}

if (cr) {
writeLog(CR);
if (newLine) {
writeLog(lineEnd);
}

if (_showColors) {
Expand Down