logging.hpp file

Public Logging API for clients.

Provides a thread-safe, type-safe and portable logging interface in form of the logging macros along with a global Logging instance.

The code in this file is based on ideas by Petru Marginean published in: Marginean, P: "Logging in C++", http://www.ddj.com/cpp/201804215 and Marginean, P: "Logging in C++: Part 2", http://www.ddj.com/cpp/221900468

Namespaces

namespace arcstk
libarcstk main namespace
namespace arcstk::v_1_0_0 inline
API version 1.0.0.

Classes

class arcstk::v_1_0_0::Appender
A named logging output channel.
class arcstk::v_1_0_0::Log
A single logging operation of a Logger using a specified LOGLEVEL.
class arcstk::v_1_0_0::Logger
Logs a message to its registered Appenders.
class arcstk::v_1_0_0::Logging
A singleton interface used by all Log instances.

Enums

enum class LOGLEVEL: int16_t { NONE = 0, ERROR = 1, WARNING = 2, INFO = 3, DEBUG = 4, DEBUG1 = 5, DEBUG2 = 6, DEBUG3 = 7, DEBUG4 = 8 }
Range of log levels.

Functions

auto now_time() -> std::string
Returns the current time in the format 'YYYY-MM-DD hh:mm:ss.lll'.

Variables

const int LOGLEVEL_MAX
Numeric representation of the maximum legal loglevel.
const int LOGLEVEL_MIN
Numeric representation of the minimal legal loglevel.

Defines

#define ARCS_LOG(loglevel)
Send log message with specified log level to log.
#define ARCS_LOG_DEBUG
Send debug message to log.
#define ARCS_LOG_ERROR
Send error message to log.
#define ARCS_LOG_INFO
Send info message to log.
#define ARCS_LOG_WARNING
Send warning message to log.
#define CLIP_LOGGING_LEVEL
Clipping for the log level.