Evo C++ Library v0.5.1
Classes | Namespaces | Macros | Enumerations | Variables
logger.h File Reference

Evo logging. More...

#include "io.h"
#include "file.h"
#include "substring.h"
#include "atomic_buffer_queue.h"
#include "thread.h"
#include "time.h"
#include "enum.h"

Go to the source code of this file.

Classes

class  ExceptionLogger
 Logger exception, see Exception. More...
 
class  Logger< MSG_BUF_SIZE >
 High performance message logger. More...
 
class  LoggerBase
 Base class for Logger. More...
 
class  LoggerInert
 Inert logger implementing the same interface as Logger. More...
 
struct  LoggerPtr< T >
 Wraps a logger pointer that can reference a logger to use or be disabled. More...
 
struct  LogLevelEnum
 LogLevel enum helper created with EVO_ENUM_REMAP(). More...
 

Namespaces

 evo
 Evo C++ Library namespace.
 

Macros

#define EVO_LOG_ALERT(LOGGER, MSG)   { if (LOGGER.check(LOG_LEVEL_ALERT)) LOGGER.log_direct(LOG_LEVEL_ALERT, MSG); }
 Helper macro for logging an alert with Logger. More...
 
#define EVO_LOG_DEBUG(LOGGER, MSG)   { if (LOGGER.check(LOG_LEVEL_DEBUG)) LOGGER.log_direct(LOG_LEVEL_DEBUG, MSG); }
 Helper macro for logging a debug message with Logger. More...
 
#define EVO_LOG_DEBUG_LOW(LOGGER, MSG)   { if (LOGGER.check(LOG_LEVEL_DEBUG_LOW)) LOGGER.log_direct(LOG_LEVEL_DEBUG_LOW, MSG); }
 Helper macro for logging a low-level debug message with Logger. More...
 
#define EVO_LOG_ERROR(LOGGER, MSG)   { if (LOGGER.check(LOG_LEVEL_ERROR)) LOGGER.log_direct(LOG_LEVEL_ERROR, MSG); }
 Helper macro for logging an error with Logger. More...
 
#define EVO_LOG_INFO(LOGGER, MSG)   { if (LOGGER.check(LOG_LEVEL_INFO)) LOGGER.log_direct(LOG_LEVEL_INFO, MSG); }
 Helper macro for logging an informational message with Logger. More...
 
#define EVO_LOG_WARN(LOGGER, MSG)   { if (LOGGER.check(LOG_LEVEL_WARN)) LOGGER.log_direct(LOG_LEVEL_WARN, MSG); }
 Helper macro for logging a warning with Logger. More...
 
#define INCL_evo_logger_h
 

Enumerations

enum  LogLevel {
  LOG_LEVEL_DISABLED = 0, LOG_LEVEL_ALERT, LOG_LEVEL_ERROR, LOG_LEVEL_WARN,
  LOG_LEVEL_INFO, LOG_LEVEL_DEBUG, LOG_LEVEL_DEBUG_LOW
}
 Log severity level used with Logger. More...
 

Variables

static const LogLevel LOG_LEVEL_REMAP []
 Log level remapping for EVO_ENUM_REMAP(). More...
 

Detailed Description

Evo logging.

Macro Definition Documentation

◆ EVO_LOG_ALERT

#define EVO_LOG_ALERT (   LOGGER,
  MSG 
)    { if (LOGGER.check(LOG_LEVEL_ALERT)) LOGGER.log_direct(LOG_LEVEL_ALERT, MSG); }

Helper macro for logging an alert with Logger.

  • This calls LOGGER.check() to check if a message at this level matches the current log level, and if so then calls LOGGER.log_direct() to log the message
  • Formatting can be done inline with MSG, for example:
    String msg;
    ...
    EVO_LOG_ALERT(logger, 0, msg.set() << "Hello " << 123)
  • MSG is only evaluated if it will be logged, which saves from allocating and formatting messages that won't be logged
  • See Logger and LOG_LEVEL_ALERT
Parameters
LOGGERThe logger to use
MSGMessage string to log, passed as const SubString&

◆ EVO_LOG_DEBUG

#define EVO_LOG_DEBUG (   LOGGER,
  MSG 
)    { if (LOGGER.check(LOG_LEVEL_DEBUG)) LOGGER.log_direct(LOG_LEVEL_DEBUG, MSG); }

Helper macro for logging a debug message with Logger.

  • This calls LOGGER.check() to check if a message at this level matches the current log level, and if so then calls LOGGER.log_direct() to log the message
  • Formatting can be done inline with MSG, for example:
    String msg;
    ...
    EVO_LOG_DEBUG(logger, 0, msg.set() << "Hello " << 123)
  • MSG is only evaluated if it will be logged, which saves from allocating and formatting messages that won't be logged
  • See Logger and LOG_LEVEL_DEBUG
Parameters
LOGGERThe logger to use
MSGMessage string to log, passed as const SubString&

◆ EVO_LOG_DEBUG_LOW

#define EVO_LOG_DEBUG_LOW (   LOGGER,
  MSG 
)    { if (LOGGER.check(LOG_LEVEL_DEBUG_LOW)) LOGGER.log_direct(LOG_LEVEL_DEBUG_LOW, MSG); }

Helper macro for logging a low-level debug message with Logger.

  • This calls LOGGER.check() to check if a message at this level matches the current log level, and if so then calls LOGGER.log_direct() to log the message
  • Formatting can be done inline with MSG, for example:
    String msg;
    ...
    EVO_LOG_DEBUG_LOW(logger, 0, msg.set() << "Hello " << 123)
  • MSG is only evaluated if it will be logged, which saves from allocating and formatting messages that won't be logged
  • See Logger and LOG_LEVEL_DEBUG_LOW
Parameters
LOGGERThe logger to use
MSGMessage string to log, passed as const SubString&

◆ EVO_LOG_ERROR

#define EVO_LOG_ERROR (   LOGGER,
  MSG 
)    { if (LOGGER.check(LOG_LEVEL_ERROR)) LOGGER.log_direct(LOG_LEVEL_ERROR, MSG); }

Helper macro for logging an error with Logger.

  • This calls LOGGER.check() to check if a message at this level matches the current log level, and if so then calls LOGGER.log_direct() to log the message
  • Formatting can be done inline with MSG, for example:
    String msg;
    ...
    EVO_LOG_ERROR(logger, 0, msg.set() << "Hello " << 123)
  • MSG is only evaluated if it will be logged, which saves from allocating and formatting messages that won't be logged
  • See Logger and LOG_LEVEL_ERROR
Parameters
LOGGERThe logger to use
MSGMessage string to log, passed as const SubString&

◆ EVO_LOG_INFO

#define EVO_LOG_INFO (   LOGGER,
  MSG 
)    { if (LOGGER.check(LOG_LEVEL_INFO)) LOGGER.log_direct(LOG_LEVEL_INFO, MSG); }

Helper macro for logging an informational message with Logger.

  • This calls LOGGER.check() to check if a message at this level matches the current log level, and if so then calls LOGGER.log_direct() to log the message
  • Formatting can be done inline with MSG, for example:
    String msg;
    ...
    EVO_LOG_INFO(logger, 0, msg.set() << "Hello " << 123)
  • MSG is only evaluated if it will be logged, which saves from allocating and formatting messages that won't be logged
  • See Logger and LOG_LEVEL_INFO
Parameters
LOGGERThe logger to use
MSGMessage string to log, passed as const SubString&

◆ EVO_LOG_WARN

#define EVO_LOG_WARN (   LOGGER,
  MSG 
)    { if (LOGGER.check(LOG_LEVEL_WARN)) LOGGER.log_direct(LOG_LEVEL_WARN, MSG); }

Helper macro for logging a warning with Logger.

  • This calls LOGGER.check() to check if a message at this level matches the current log level, and if so then calls LOGGER.log_direct() to log the message
  • Formatting can be done inline with MSG, for example:
    String msg;
    ...
    EVO_LOG_WARN(logger, 0, msg.set() << "Hello " << 123)
  • MSG is only evaluated if it will be logged, which saves from allocating and formatting messages that won't be logged
  • See Logger and LOG_LEVEL_WARN
Parameters
LOGGERThe logger to use
MSGMessage string to log, passed as const SubString&

◆ INCL_evo_logger_h

#define INCL_evo_logger_h