1 #ifndef _MADARA_LOGGER_LOGGER_H_ 2 #define _MADARA_LOGGER_LOGGER_H_ 4 #include "madara/MADARA_export.h" 5 #include "madara/LockType.h" 6 #include <ace/Guard_T.h> 20 #define madara_logger_log(logger, level, ...) \ 21 if (level <= logger.get_level ()) \ 22 logger.log (level, __VA_ARGS__); 32 #define madara_logger_ptr_log(logger, level, ...) \ 33 if (logger && level <= logger->get_level ()) \ 34 logger->log (level, __VA_ARGS__); 43 #define madara_logger_cond_log_ptrs(conditional, logger_ptr, alt_logger_ptr, level, ...) \ 44 if (conditional && logger_ptr && level <= logger_ptr->get_level ()) \ 45 logger_ptr->log (level, __VA_ARGS__); \ 47 alt_logger_ptr->log (level, __VA_ARGS__); 56 #define madara_logger_cond_log(conditional, logger, alt_logger_ptr, level, ...) \ 57 if (conditional && level <= logger.get_level ()) \ 58 logger.log (level, __VA_ARGS__); \ 60 alt_logger_ptr->log (level, __VA_ARGS__); 95 Logger (
bool log_to_stderr =
true);
107 void log (
int level,
const char * message, ...);
118 void add_term (
void);
123 void add_syslog (
void);
129 void set_level (
int level);
147 int get_level (
void);
161 void set_timestamp_format (
const std::string & format =
"%x %X: ");
197 #endif // _MADARA_LOGGER_LOGGER_H_
int level_
the maximum detail level for logging
std::string timestamp_format_
the timestamp format. Default is "" for no timestamp
bool term_added_
tracks whether terminal output has been added
Provides knowledge logging services to files and terminals.
A multi-threaded logger for logging to one or more destinations.
FileVectors files_
list of all log outputs
bool syslog_added_
tracks whether the system log has been added
LogLevels
Logging levels available for MADARA library.
std::vector< FILE * > FileVectors
guard for access and changes
MADARA_LOCK_TYPE mutex_
mutex for changes
Copyright (c) 2015 Carnegie Mellon University.
std::string tag_
the tag used for logging to system logs
void log(int level, const char *message)
Logs a simple string message.