14#define ENABLE_STD_STRING
18#ifdef ENABLE_STD_STRING
23#include <avr/pgmspace.h>
26#define JBLOGGER_VERSION "1.0.5"
27#define MAX_MESSAGE_LENGTH 128
57 Stream &stream = Serial,
bool showLogLevel =
true,
58 bool showModuleName =
true,
bool showTimestamp =
true);
73 void log(
LogLevel logLevel,
bool writePrefix,
bool writeLinefeed,
const char *message, ...);
75#ifdef ENABLE_STD_STRING
89 void log(
LogLevel logLevel,
bool writePrefix,
bool writeLinefeed, std::string& message, ...);
105 void log(
LogLevel logLevel,
bool writePrefix,
bool writeLinefeed, String& message, ...);
120 void log(
LogLevel logLevel,
bool writePrefix,
bool writeLinefeed,
const __FlashStringHelper* message, ...);
138 template<
class T,
typename... Args>
139 void error(T message, Args... args) {
158 template<
class T,
typename... Args>
178 template<
class T,
typename... Args>
179 void info(T message, Args... args) {
198 template<
class T,
typename... Args>
199 void debug(T message, Args... args) {
218 template<
class T,
typename... Args>
219 void trace(T message, Args... args) {
234 void traceDump(
const void* buffer, uint32_t size);
342 const char *_moduleName;
343 bool _showLogLevel =
true;
344 bool _showModuleName =
true;
345 bool _showTimestamp =
true;
349 void _printPrefix(
LogLevel logLevel)
const;
Logging class.
Definition jblogger.h:46
void setShowLogLevel(bool value)
Specifies whether the log level should be displayed in log messages.
Definition jblogger.cpp:374
void info(T message, Args... args)
Log a message with the INFO log level.
Definition jblogger.h:179
void error(T message, Args... args)
Log a message with the ERROR log level.
Definition jblogger.h:139
void trace(T message, Args... args)
Log a message with the TRACE log level.
Definition jblogger.h:219
void setLogLevel(LogLevel level)
Sets the minimum log level for messages to be logged.
Definition jblogger.cpp:366
bool getShowTimestamp() const
Returns whether timestamps should be displayed in log messages.
Definition jblogger.cpp:394
void log(LogLevel logLevel, bool writePrefix, bool writeLinefeed, const char *message,...)
Logs a const char* message with the specified log level.
Definition jblogger.cpp:21
void setShowTimestamp(bool value)
Specifies whether timestamps should be displayed in log messages.
Definition jblogger.cpp:390
bool getShowModuleName() const
Returns whether the module name should be displayed in log messages.
Definition jblogger.cpp:386
void debug(T message, Args... args)
Log a message with the DEBUG log level.
Definition jblogger.h:199
void traceDump(const void *buffer, uint32_t size)
Log a hex and ASCII dump of a memory buffer with the TRACE log level.
Definition jblogger.cpp:82
LogLevel getLogLevel()
Returns the minimum log level for messages to be logged.
Definition jblogger.cpp:370
void traceAsciiDump(const void *buffer, uint32_t size)
Trace an ASCII dump of a memory buffer.
Definition jblogger.cpp:149
void setShowModuleName(bool value)
Specifies whether the module name should be displayed in log messages.
Definition jblogger.cpp:382
void setOutput(Stream &stream)
Allows you to specify the output stream for logging.
Definition jblogger.cpp:358
Stream & getOutput()
Returns the output stream for logging.
Definition jblogger.cpp:362
void warning(T message, Args... args)
Log a message with the WARNING log level.
Definition jblogger.h:159
void traceHexDump(const void *buffer, uint32_t size)
Log a hex dump of a memory buffer with the TRACE log level.
Definition jblogger.cpp:124
void traceBinaryDump(const void *buffer, uint32_t size)
Logs a a binary dump of a memory buffer with the TRACE log level.
Definition jblogger.cpp:329
bool getShowLogLevel() const
Returns whether the log level should be displayed in log messages.
Definition jblogger.cpp:378
LogLevel
Log levels.
Definition jblogger.h:30
@ LOG_LEVEL_DEBUG
Debug logging.
Definition jblogger.h:35
@ LOG_LEVEL_ERROR
Error logging.
Definition jblogger.h:32
@ LOG_LEVEL_WARNING
Warning logging.
Definition jblogger.h:33
@ LOG_LEVEL_NONE
No logging.
Definition jblogger.h:31
@ LOG_LEVEL_TRACE
Trace logging.
Definition jblogger.h:36
@ LOG_LEVEL_INFO
Info logging.
Definition jblogger.h:34