2 #ifndef _MADARA_LOGGER_LOGGER_INL_ 3 #define _MADARA_LOGGER_LOGGER_INL_ 8 #ifdef _MADARA_ANDROID_ 9 #include <android/log.h> 17 "Logger::add_file: attempting to open file %s\n",
22 FILE * new_file = fopen (filename.c_str (),
"a+");
27 "Logger::add_file: opened file %s for logging\n",
30 MADARA_GUARD_TYPE guard (
mutex_);
32 files_.push_back (new_file);
37 "Logger::add_file: unable to open file %s for logging\n",
46 MADARA_GUARD_TYPE guard (
mutex_);
54 MADARA_GUARD_TYPE guard (
mutex_);
62 MADARA_GUARD_TYPE guard (
mutex_);
70 MADARA_GUARD_TYPE guard (
mutex_);
78 MADARA_GUARD_TYPE guard (
mutex_);
86 MADARA_GUARD_TYPE guard (
mutex_);
94 MADARA_GUARD_TYPE guard (
mutex_);
99 for (FileVectors::iterator i =
files_.begin ();
114 MADARA_GUARD_TYPE guard (
mutex_);
119 #endif // _MADARA_LOGGER_LOGGER_INL_ std::string get_tag(void)
Gets the tag used for syslogs.
int level_
the maximum detail level for logging
std::string timestamp_format_
the timestamp format. Default is "" for no timestamp
void set_level(int level)
Sets the maximum logging detail level.
bool term_added_
tracks whether terminal output has been added
int get_level(void)
Gets the maximum logging detail level.
FileVectors files_
list of all log outputs
bool syslog_added_
tracks whether the system log has been added
#define madara_logger_ptr_log(logger, level,...)
Fast version of the madara::logger::log method for Logger pointers.
void add_file(const std::string &filename)
Adds a file to the logger.
void add_syslog(void)
Adds the system log.
void set_timestamp_format(const std::string &format="%x %X: ")
Sets timestamp format.
void add_term(void)
Adds terminal to logger outputs.
void clear(void)
Clears all log targets.
MADARA_LOCK_TYPE mutex_
mutex for changes
std::string tag_
the tag used for logging to system logs
void set_tag(const std::string &tag)
Sets the tag used for syslogs (e.g.