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);
256 Logger(
LogLevel level,
const std::string &tag,
int debug_verbosity = 0);
261 LoggerOutput(std::ostream &stream,
const unsigned char logmask,
const unsigned char options);
262 virtual ~LoggerOutput();
264 void log(
const Logger &log);
266 std::ostream &_stream;
267 unsigned char _level;
268 unsigned char _options;
275 virtual ~LogWriter();
343 void writeBuffer(std::ostream&,
const unsigned char logmask,
const unsigned char options);
348 void __cancellation() throw ();
354 void flush(const
Logger &logger);
356 unsigned char _global_logmask;
359 unsigned char _syslog_mask;
361 ibrcommon::Queue<
Logger> _queue;
363 std::list<LoggerOutput> _logger;
365 ibrcommon::Mutex _buffer_mutex;
367 std::list<
Logger> *_buffer;
369 ibrcommon::Mutex _logfile_mutex;
370 ibrcommon::File _logfile;
371 std::ofstream _logfile_stream;
372 LoggerOutput *_logfile_output;
373 unsigned char _logfile_logmask;
374 unsigned char _logfile_options;
378 const std::
string _tag;
379 int _debug_verbosity;
380 struct timeval _logtime;
384 static std::
string _default_tag;
385 static std::
string _android_tag_prefix;
386 static LogWriter _logwriter;