2 #ifndef _MADARA_LOGGER_LOGGER_INL_
3 #define _MADARA_LOGGER_LOGGER_INL_
8 #ifdef _MADARA_ANDROID_
9 #include <android/log.h>
15 "Logger::add_file: attempting to open file %s\n", filename.c_str());
19 FILE* new_file = fopen(filename.c_str(),
"a+");
24 "Logger::add_file: opened file %s for logging\n", filename.c_str());
26 MADARA_GUARD_TYPE guard(
mutex_);
28 files_.push_back(new_file);
33 "Logger::add_file: unable to open file %s for logging\n",
46 MADARA_GUARD_TYPE guard(mutex_);
58 inline std::string madara::logger::Logger::get_thread_name(
void)
63 inline double madara::logger::Logger::get_thread_hertz(
void)
68 inline void madara::logger::Logger::set_thread_level(
int level)
70 thread_level_ = level;
73 inline void madara::logger::Logger::set_thread_name(
const std::string name)
78 inline void madara::logger::Logger::set_thread_hertz(
double hertz)
80 thread_hertz_ = hertz;
94 MADARA_GUARD_TYPE guard(mutex_);
106 MADARA_GUARD_TYPE guard(mutex_);
108 this->term_added_ =
true;
113 MADARA_GUARD_TYPE guard(mutex_);
115 this->syslog_added_ =
true;
120 MADARA_GUARD_TYPE guard(mutex_);
122 this->term_added_ =
false;
123 this->syslog_added_ =
false;
125 for (FileVectors::iterator i = files_.begin(); i != files_.end(); ++i)
139 MADARA_GUARD_TYPE guard(mutex_);
141 this->timestamp_format_ = format;
#define madara_logger_ptr_log(loggering, level,...)
Fast version of the madara::logger::log method for Logger pointers.
static int get_thread_level(void)
Fetches thread local storage value for thread level.
int get_level(void)
Gets the maximum logging detail level.
void add_file(const std::string &filename)
Adds a file to the logger.
void add_term(void)
Adds terminal to logger outputs.
void set_tag(const std::string &tag)
Sets the tag used for syslogs (e.g.
void set_timestamp_format(const std::string &format="%x %X: ")
Sets timestamp format.
MADARA_LOCK_TYPE mutex_
mutex for changes
void clear(void)
Clears all log targets.
void add_syslog(void)
Adds the system log.
FileVectors files_
list of all log outputs
std::string get_tag(void)
Gets the tag used for syslogs.
void set_level(int level)
Sets the maximum logging detail level.