64 #define IBRCOMMON_LOGGER_LEVEL \
65 ibrcommon::Logger::getVerbosity()
67 #define IBRCOMMON_LOGGER(level) \
68 if (ibrcommon::LogLevel::level & ibrcommon::Logger::getLogMask()) { \
69 ibrcommon::Logger __macro_ibrcommon_logger = ibrcommon::Logger::level(""); \
70 std::stringstream __macro_ibrcommon_stream; __macro_ibrcommon_stream
72 #define IBRCOMMON_LOGGER_TAG(tag, level) \
73 if (ibrcommon::LogLevel::level & ibrcommon::Logger::getLogMask()) { \
74 ibrcommon::Logger __macro_ibrcommon_logger = ibrcommon::Logger::level(tag); \
75 std::stringstream __macro_ibrcommon_stream; __macro_ibrcommon_stream
77 #define IBRCOMMON_LOGGER_DEBUG(verbosity) \
78 if (ibrcommon::Logger::getVerbosity() >= verbosity) \
80 ibrcommon::Logger __macro_ibrcommon_logger = ibrcommon::Logger::debug("", verbosity); \
81 std::stringstream __macro_ibrcommon_stream; __macro_ibrcommon_stream
83 #define IBRCOMMON_LOGGER_DEBUG_TAG(tag, verbosity) \
84 if (ibrcommon::Logger::getVerbosity() >= verbosity) \
86 ibrcommon::Logger __macro_ibrcommon_logger = ibrcommon::Logger::debug(tag, verbosity); \
87 std::stringstream __macro_ibrcommon_stream; __macro_ibrcommon_stream
89 #define IBRCOMMON_LOGGER_ENDL \
91 __macro_ibrcommon_logger.setMessage(__macro_ibrcommon_stream.str()); \
92 __macro_ibrcommon_logger.print(); \
95 #define IBRCOMMON_LOGGER_ex(level) \
96 IBRCOMMON_LOGGER(level) << __PRETTY_FUNCTION__ << ": "
98 #define IBRCOMMON_LOGGER_DEBUG_ex(verbosity) \
99 IBRCOMMON_LOGGER_DEBUG(verbosity) << __FILE__ << ":" << __LINE__ << " in " << __PRETTY_FUNCTION__ << ": "
159 const std::string&
str()
const;
168 static Logger debug(
const std::string &tag,
int verbosity);
210 static void enableSyslog(
const char *name,
int option,
int facility,
const unsigned char logmask =
LOGGER_INFO);
263 const std::string&
getTag()
const;
276 Logger(
LogLevel level,
const std::string &tag,
int debug_verbosity = 0);
279 const std::string _tag;
280 int _debug_verbosity;
281 struct timeval _logtime;
359 void writeBuffer(std::ostream&,
const unsigned char logmask,
const unsigned char options);
380 LoggerOutput(std::ostream &stream,
const unsigned char logmask,
const unsigned char options);
381 virtual ~LoggerOutput();
385 std::ostream &_stream;
386 unsigned char _level;
387 unsigned char _options;
400 unsigned char _global_logmask;
403 unsigned char _syslog_mask;
407 std::list<LoggerOutput> _logger;
411 std::list<Logger> *_buffer;
415 std::ofstream _logfile_stream;
416 LoggerOutput *_logfile_output;
417 unsigned char _logfile_logmask;
418 unsigned char _logfile_options;
420 std::string _default_tag;
421 std::string _android_tag_prefix;