nidas  v1.2-1520
Logger.h
Go to the documentation of this file.
1 // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 4; tab-width: 4; -*-
2 // vim: set shiftwidth=4 softtabstop=4 expandtab:
3 /*
4  ********************************************************************
5  ** NIDAS: NCAR In-situ Data Acquistion Software
6  **
7  ** 2006, Copyright University Corporation for Atmospheric Research
8  **
9  ** This program is free software; you can redistribute it and/or modify
10  ** it under the terms of the GNU General Public License as published by
11  ** the Free Software Foundation; either version 2 of the License, or
12  ** (at your option) any later version.
13  **
14  ** This program is distributed in the hope that it will be useful,
15  ** but WITHOUT ANY WARRANTY; without even the implied warranty of
16  ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  ** GNU General Public License for more details.
18  **
19  ** The LICENSE.txt file accompanying this software contains
20  ** a copy of the GNU General Public License. If it is not found,
21  ** write to the Free Software Foundation, Inc.,
22  ** 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23  **
24  ********************************************************************
25 */
26 
27 #ifndef NIDAS_UTIL_LOGGER_H_
28 #define NIDAS_UTIL_LOGGER_H_
29 
30 #include "ThreadSupport.h"
31 
32 #include <cstdarg>
33 #include <syslog.h>
34 
35 #include <iostream>
36 #include <string>
37 #include <sstream>
38 #include <cstdio>
39 #include <cstring>
40 #include <vector>
41 #include <map>
42 
43 #if !defined(SVR4) && ( defined(__GNUC__) && __GNUC__ < 2)
44 #include <varargs.h>
45 #endif
46 
47 namespace nidas { namespace util {
48 
166  const int LOGGER_EMERG = LOG_EMERG;
168  const int LOGGER_ALERT = LOG_ALERT;
169  const int LOGGER_CRIT = LOG_CRIT;
171  const int LOGGER_ERROR = LOG_ERR;
172  const int LOGGER_ERR = LOG_ERR;
173  const int LOGGER_PROBLEM = LOG_ERR;
176  const int LOGGER_INFO = LOG_INFO;
177  const int LOGGER_DEBUG = LOG_DEBUG;
178  const int LOGGER_VERBOSE = LOG_DEBUG+1;
179  const int LOGGER_NONE = LOG_EMERG-1;
182 #undef LOG_EMERG
183 #undef LOG_ALERT
184 #undef LOG_CRIT
185 #undef LOG_ERR
186 #undef LOG_WARNING
187 #undef LOG_NOTICE
188 #undef LOG_INFO
189 #undef LOG_DEBUG
190 
191 #define LOG_CONTEXT(LEVEL) \
192  nidas::util::LEVEL, __FILE__, __PRETTY_FUNCTION__, __LINE__
193 
200 #define LOG_STATIC_CONTEXT(LEVEL) \
201  nidas::util::LEVEL, __FILE__, "file_static_scope", __LINE__
202 
203  // Redefine the log levels to be a full LogContext instance.
204 #define LOG_EMERG LOG_CONTEXT(LOGGER_EMERG)
205 #define LOG_ALERT LOG_CONTEXT(LOGGER_ALERT)
206 #define LOG_CRIT LOG_CONTEXT(LOGGER_CRIT)
207 #define LOG_ERR LOG_CONTEXT(LOGGER_ERR)
208 #define LOG_WARNING LOG_CONTEXT(LOGGER_WARNING)
209 #define LOG_NOTICE LOG_CONTEXT(LOGGER_NOTICE)
210 #define LOG_INFO LOG_CONTEXT(LOGGER_INFO)
211 #define LOG_DEBUG LOG_CONTEXT(LOGGER_DEBUG)
212 #define LOG_VERBOSE LOG_CONTEXT(LOGGER_VERBOSE)
213 
248 #define LOGGER_LOGPOINT(LEVEL,TAGS,MSG) \
249  do { \
250  static nidas::util::LogContext logctxt \
251  (nidas::util::LEVEL, __FILE__,__PRETTY_FUNCTION__, \
252  __LINE__,TAGS); \
253  if (logctxt.active()) \
254  logctxt.log(nidas::util::LogMessage().format MSG); } \
255  while (0)
256 
299 #define ELOG(MSG) LOGGER_LOGPOINT(LOGGER_EMERG,"",MSG)
300 #define ALOG(MSG) LOGGER_LOGPOINT(LOGGER_ALERT,"",MSG)
301 #define CLOG(MSG) LOGGER_LOGPOINT(LOGGER_CRITICAL,"",MSG)
302 #define PLOG(MSG) LOGGER_LOGPOINT(LOGGER_ERR,"",MSG) // For Problem, as in Error
303 #define WLOG(MSG) LOGGER_LOGPOINT(LOGGER_WARNING,"",MSG)
304 #define NLOG(MSG) LOGGER_LOGPOINT(LOGGER_NOTICE,"",MSG)
305 #define ILOG(MSG) LOGGER_LOGPOINT(LOGGER_INFO,"",MSG)
306 #define DLOG(MSG) LOGGER_LOGPOINT(LOGGER_DEBUG,"",MSG)
307 #define VLOG(MSG) LOGGER_LOGPOINT(LOGGER_VERBOSE,"",MSG)
308 
309 #define ELOGT(TAGS,MSG) LOGGER_LOGPOINT(LOGGER_EMERG,TAGS,MSG)
310 #define ALOGT(TAGS,MSG) LOGGER_LOGPOINT(LOGGER_ALERT,TAGS,MSG)
311 #define CLOGT(TAGS,MSG) LOGGER_LOGPOINT(LOGGER_CRITICAL,TAGS,MSG)
312 #define PLOGT(TAGS,MSG) LOGGER_LOGPOINT(LOGGER_ERR,TAGS,MSG) // For Problem, as in Error
313 #define WLOGT(TAGS,MSG) LOGGER_LOGPOINT(LOGGER_WARNING,TAGS,MSG)
314 #define NLOGT(TAGS,MSG) LOGGER_LOGPOINT(LOGGER_NOTICE,TAGS,MSG)
315 #define ILOGT(TAGS,MSG) LOGGER_LOGPOINT(LOGGER_INFO,TAGS,MSG)
316 #define DLOGT(TAGS,MSG) LOGGER_LOGPOINT(LOGGER_DEBUG,TAGS,MSG)
317 #define VLOGT(TAGS,MSG) LOGGER_LOGPOINT(LOGGER_VERBOSE,TAGS,MSG)
318 
320  class Logger;
321  class LoggerPrivate;
322  class LogMessage;
323 
328  int
329  stringToLogLevel(const std::string& slevel);
330 
335  std::string
336  logLevelToString(int);
337 
338  class Mutex;
339 
383  {
384  public:
385 
395  LogContext (int level, const char* file, const char* function, int line,
396  const char* tags = 0);
397 
398  ~LogContext();
399 
405  bool
406  active() const
407  {
408  return _active;
409  }
410 
411  const char*
412  filename() const
413  {
414  return _file;
415  }
416 
417  const char*
418  function() const
419  {
420  return _function;
421  }
422 
423  int
424  line() const
425  {
426  return _line;
427  }
428 
429  int
430  level() const
431  {
432  return _level;
433  }
434 
435  const char*
436  tags() const
437  {
438  return _tags;
439  }
440 
447  std::string
448  threadName() const;
449 
450  std::string
451  levelName() const
452  {
453  return logLevelToString(_level);
454  }
455 
470  inline void
471  log(const std::string& msg) const;
472 
490  inline LogMessage
491  log() const;
492 
493  private:
494  int _level;
495  const char* _file;
496  const char* _function;
497  int _line;
498  const char* _tags;
499 
500  bool _active;
501 
502  pthread_t _threadId;
503 
504  friend class nidas::util::Logger;
506 
508  LogContext (const LogContext&);
509 
512  };
513 
514 
530  class LogConfig
531  {
532  public:
533 
538  std::string filename_match;
539 
544  std::string function_match;
545 
550  std::string tag_match;
551 
557  int line;
558 
564  int level;
565 
570  bool activate;
571 
575  bool
576  matches(const LogContext& lc) const;
577 
607  LogConfig&
608  parse(const std::string& text);
609 
615  LogConfig(const std::string& text = "");
616  };
617 
618 
623  class LogScheme
624  {
625  public:
626 
627  enum LogField
628  {
632  FileField = 4,
635  TimeField = 32,
637  };
638 
642  typedef std::vector<LogConfig> log_configs_v;
643 
649  static LogField
650  stringToField(const std::string& s);
651 
656  static std::string
658 
669  explicit
670  LogScheme(const std::string& name = "");
671 
676  LogScheme&
677  setName(const std::string& name)
678  {
679  if (name.length() > 0)
680  _name = name;
681  return *this;
682  }
683 
684  const std::string&
685  getName() const
686  {
687  return _name;
688  }
689 
694  LogScheme&
695  clearConfigs();
696 
713  LogScheme&
714  addConfig(const LogConfig& lc);
715 
722  LogScheme&
723  addConfig(const std::string& config);
724 
738  LogScheme&
739  addFallback(const LogConfig& lc);
740 
741  LogScheme&
742  addFallback(const std::string& config);
743 
749  getConfigs();
750 
763  int
764  logLevel();
765 
773  LogScheme&
774  setShowFields(const std::vector<LogField>& fields);
775 
783  LogScheme&
784  setShowFields(const std::string& fields);
785 
790  std::string
791  getShowFieldsString () const;
792 
796  bool
797  parseParameter(const std::string& text);
798 
802  void
803  setParameter(const std::string& name, const std::string& value);
804 
811  std::string
812  getParameter(const std::string& name, const std::string& dvalue="");
813 
842  template <typename T>
843  T
844  getParameterT(const std::string& name, const T& dvalue = T());
845 
851  std::string
852  getEnvParameter(const std::string& name, const std::string& dvalue="");
853 
859  void
860  showLogPoints(bool show);
861 
865  bool
867  {
868  return _showlogpoints;
869  }
870 
871  private:
872 
873  void
875 
876  std::string _name;
878  std::vector<LogField> log_fields;
879  std::map<std::string, std::string> _parameters;
882 
884  friend class nidas::util::Logger;
886  };
887 
888 
896  {
897  public:
901  LogMessage(const std::string& s = "") :
902  msg(),
903  _log_context(0)
904  {
905  msg << s;
906  }
907 
940  LogMessage(const LogContext* lp, const std::string& s = "") :
941  msg(),
942  _log_context(lp)
943  {
944  msg << s;
945  }
946 
947  LogMessage(const LogMessage& right) :
948  msg(),
950  {
951  msg << right.msg.str();
952  }
953 
954  LogMessage&
955  operator=(const LogMessage& right)
956  {
957  msg << right.msg.str();
958  _log_context = right._log_context;
959  return *this;
960  }
961 
962  LogMessage&
963  format(const char *fmt, ...);
964 
965  std::string
966  getMessage() const
967  {
968  return msg.str();
969  }
970 
971  operator std::string () const
972  {
973  return msg.str();
974  }
975 
976  template <typename T>
977  LogMessage&
978  operator<< (const T& t);
979 
986  {
987  log();
988  }
989 
1003  inline std::streampos
1005  {
1006  return msg.tellp();
1007  }
1008 
1014  void
1016  {
1017  if (_log_context && length() > 0)
1018  {
1019  _log_context->log(*this);
1020  }
1021  msg.str("");
1022  msg.clear();
1023  }
1024 
1025  private:
1026  std::ostringstream msg;
1028  };
1029 
1030 
1035  template <typename T>
1036  inline
1037  LogMessage&
1038  LogMessage::
1039  operator<< (const T& t)
1040  {
1041  msg << t;
1042  return *this;
1043  }
1044 
1045 
1050  inline LogMessage&
1052  {
1053  logmsg.log();
1054  return logmsg;
1055  }
1056 
1061  inline LogMessage&
1063  {
1064  return (*op)(logmsg);
1065  }
1066 
1077  class Logger {
1078  protected:
1079  Logger(const std::string& ident, int logopt, int facility,
1080  const char *TZ = 0);
1081  Logger(std::ostream* );
1082  Logger();
1083 
1084  public:
1085 
1094  static Logger*
1095  createInstance(const std::string& ident, int logopt, int facility,
1096  const char *TZ = 0);
1097 
1105  static Logger* createInstance(std::ostream* out = 0);
1106 
1130  static Logger* getInstance();
1131 
1138  static void
1139  destroyInstance();
1140 
1157 #if defined(SVR4) || ( defined(__GNUC__) && __GNUC__ > 1 )
1158  void
1159  log(int severity, const char* file, const char* fn,
1160  int line, const char *fmt, ...);
1161 #elif defined(__GNUC__)
1162  void
1163  log(...);
1164 #else
1165  void
1166  log(va_alist);
1167 #endif
1168 
1181  void
1182  msg(const LogContext& lc, const std::string& msg);
1183 
1184  inline void
1185  msg(const LogContext& lc, const LogMessage& m)
1186  {
1187  msg (lc, m.getMessage());
1188  }
1189 
1213  static void
1214  setScheme(const std::string& name);
1215 
1220  static void
1221  setScheme(const LogScheme& scheme);
1222 
1230  static void
1231  updateScheme(const LogScheme& scheme);
1232 
1240  static LogScheme
1241  getScheme(const std::string& name);
1242 
1247  static LogScheme
1248  getScheme();
1249 
1258  static bool
1259  knownScheme(const std::string& name);
1260 
1265  static void
1266  clearSchemes();
1267 
1270  protected:
1281  void setTZ(const char* val);
1282 
1284 
1285  std::ostream* output;
1286  bool syslogit;
1287 
1288  char* loggerTZ;
1289  char* saveTZ;
1290  char* _ident;
1291 
1292  private:
1293 
1298  void
1299  msg_locked(const nidas::util::LogContext& lc, const std::string& msg);
1300 
1307  static Logger*
1308  get_instance_locked(std::ostream* out = 0);
1309 
1312 
1314 
1315  ~Logger();
1316 
1318  Logger(const Logger&);
1319 
1321  Logger& operator=(const Logger&);
1322  };
1323 
1324  inline void
1325  LogContext::
1326  log(const std::string& msg) const
1327  {
1328  Logger::getInstance()->msg (*this, msg);
1329  }
1330 
1331  inline LogMessage
1332  LogContext::
1333  log() const
1334  {
1335  return LogMessage(this);
1336  }
1337 
1338  template <typename T>
1339  T
1340  LogScheme::
1341  getParameterT(const std::string& name, const T& dvalue)
1342  {
1343  // A rudimentary implementation which converts strings
1344  // to the given type.
1345  T value;
1346  std::istringstream text(getParameter(name));
1347  text >> value;
1348  if (text.fail())
1349  value = dvalue;
1350  return value;
1351  }
1352 
1355 }} // namespace nidas namespace util
1356 
1357 #endif
void show_log_point(LogContext &lp)
Definition: Logger.cc:983
LogConfig & parse(const std::string &text)
Parse LogConfig settings from a string specifier, using comma-separated fields to assign to each of t...
Definition: Logger.cc:637
const int LOGGER_NOTICE
Definition: Logger.h:175
std::string filename_match
Apply this config to log points in filenames which contain the given string.
Definition: Logger.h:538
void msg_locked(const nidas::util::LogContext &lc, const std::string &msg)
Other Log classes call this method to log a message when the log mutex is already locked...
Definition: Logger.cc:339
const char * _tags
Definition: Logger.h:498
static void destroyInstance()
Destroy any existing Logger instance.
Definition: Logger.cc:246
char * saveTZ
Definition: Logger.h:1289
const int LOGGER_ALERT
Definition: Logger.h:168
Definition: Logger.h:633
static Logger * createInstance(const std::string &ident, int logopt, int facility, const char *TZ=0)
Create a syslog-type Logger.
Definition: Logger.cc:260
static Logger * get_instance_locked(std::ostream *out=0)
Return the current instance or create a default, without locking.
Definition: Logger.cc:272
const int LOGGER_ERR
Definition: Logger.h:172
const LogContext * _log_context
Definition: Logger.h:1027
std::vector< LogConfig > log_configs_v
The type for the vector of LogConfigs returned by getConfigs().
Definition: Logger.h:642
Logger & operator=(const Logger &)
No assignment.
#define LOG_EMERG
Definition: Logger.h:204
const int LOGGER_CRIT
Definition: Logger.h:169
#define LOG_CRIT
Definition: Logger.h:206
std::ostream * output
Definition: Logger.h:1285
The LogContext is created at a point in the application code and filled in with details about that lo...
Definition: Logger.h:382
LogMessage log() const
Return a LogMessage associated with this LogContext, so the message will be logged through this conte...
Definition: Logger.h:1333
#define LOG_INFO
Definition: Logger.h:210
LogScheme & setName(const std::string &name)
LogScheme names must not be empty, so this method has no effect unless name.length() &gt; 0...
Definition: Logger.h:677
pthread_t _threadId
Definition: Logger.h:502
std::string function_match
Apply this config to log points in functions which contain the given string.
Definition: Logger.h:544
int _line
Definition: Logger.h:497
Logger()
Definition: Logger.cc:225
A class for formatting and streaming a log message.
Definition: Logger.h:895
const int LOGGER_CRITICAL
Definition: Logger.h:170
static void updateScheme(const LogScheme &scheme)
Update or insert this scheme in the collection of log schemes.
Definition: Logger.cc:533
void setParameter(const std::string &name, const std::string &value)
Set a parameter for this scheme.
Definition: Logger.cc:939
LogConfig(const std::string &text="")
Construct a default LogConfig which matches and enables every log point with level DEBUG or higher...
Definition: Logger.cc:581
bool matches(const LogContext &lc) const
Return true if this config matches the given LogContext lc.
Definition: Logger.cc:595
int logLevel()
Return the highest level of log messages enabled in all the LogConfig instances added to this LogSche...
Definition: Logger.cc:872
Definition: Logger.cc:136
bool active() const
Return true if log messages from this context would be accepted.
Definition: Logger.h:406
Definition: Logger.h:630
const int LOGGER_NONE
Definition: Logger.h:179
const int LOGGER_DEBUG
Definition: Logger.h:177
LogMessage & operator<<(const T &t)
Everything streamed to a LogMessage is passed on to the underlying ostringstream, including ostream m...
Definition: Logger.h:1039
LogContext & operator=(const LogContext &)
No assignment.
A LogScheme is a vector of LogConfig&#39;s and the vector of fields to show in log messages.
Definition: Logger.h:623
LogMessage & endlog(LogMessage &logmsg)
LogMessage manipulator which logs the current message buffer, if any, and then clears the message...
Definition: Logger.h:1051
LogMessage & operator<<(LogMessage &logmsg, LogMessage &(*op)(LogMessage &))
Template to call LogMessage manipulators like endlog when streamed to a LogMessage.
Definition: Logger.h:1062
const int LOGGER_INFO
Definition: Logger.h:176
static nidas::util::Mutex mutex
Definition: Logger.h:1313
void log(va_alist)
Build a message from a printf-format string and variable args, and log the message.
Definition: Logger.cc:444
static void setScheme(const std::string &name)
Set the current scheme.
Definition: Logger.cc:485
#define LOG_ALERT
Definition: Logger.h:205
A configuration to enable or disable a matching set of log points.
Definition: Logger.h:530
static std::string fieldToString(LogScheme::LogField lf)
Convert a LogField to its lower-case string name.
Definition: Logger.cc:904
#define LOG_DEBUG
Definition: Logger.h:211
const int LOGGER_ERROR
Definition: Logger.h:171
bool _fallbacks
Definition: Logger.h:881
Definition: Logger.h:635
int _level
Definition: Logger.h:494
string logLevelToString(int level)
Convert an integral log level to a string name.
Definition: Logger.cc:1118
Definition: Logger.h:634
~Logger()
Definition: Logger.cc:234
std::string getShowFieldsString() const
Return a comma-separated string describing the list of fields to be shown by this scheme...
Definition: Logger.cc:798
std::string tag_match
Apply this config to log points whose tags include this tag.
Definition: Logger.h:550
#define LOG_ERR
Definition: Logger.h:207
bool _showlogpoints
Definition: Logger.h:880
bool syslogit
Definition: Logger.h:1286
~LogMessage()
If this message was associated with a LogContext, then send the completed message to it when this ins...
Definition: Logger.h:985
const char * _function
Definition: Logger.h:496
static Logger * getInstance()
Retrieve the current Logger singleton instance.
Definition: Logger.cc:293
const int LOGGER_VERBOSE
Definition: Logger.h:178
Definition: Logger.h:629
static void clearSchemes()
Erase all known schemes and reset the active scheme to the name initialized at application start...
Definition: Logger.cc:547
std::string threadName() const
Return the name of the thread which created this context.
Definition: Logger.cc:1054
std::string getEnvParameter(const std::string &name, const std::string &dvalue="")
Return the value of the parameter.
Definition: Logger.cc:961
int level() const
Definition: Logger.h:430
Definition: Logger.h:636
const char * _file
Definition: Logger.h:495
log_configs_v getConfigs()
Return a copy of the LogConfig instances added to this LogScheme.
Definition: Logger.cc:864
int line
Apply this config to log points with the given line number.
Definition: Logger.h:557
bool parseParameter(const std::string &text)
Parse a parameter setting using syntax &lt;name&gt;=.
Definition: Logger.cc:918
static LogScheme getScheme()
Return the current LogScheme, creating the default LogScheme if it has not been set yet...
Definition: Logger.cc:515
bool getShowLogPoints()
Return true if showLogPoints() is enabled.
Definition: Logger.h:866
LogScheme & addFallback(const LogConfig &lc)
Add a fallback LogConfig.
Definition: Logger.cc:843
bool _active
Definition: Logger.h:500
T getParameterT(const std::string &name, const T &dvalue=T())
Lookup a parameter with name name in a LogScheme and convert the value to the type of the dvalue para...
Definition: Logger.h:1341
const int LOGGER_EMERGENCY
Definition: Logger.h:167
~LogContext()
Definition: Logger.cc:1066
void log()
If this LogMessage is associated with a LogContext and if the current message is not empty...
Definition: Logger.h:1015
char * loggerTZ
Definition: Logger.h:1288
#define LOG_WARNING
Definition: Logger.h:208
bool activate
If true, then all matching log points will be enabled.
Definition: Logger.h:570
Simple logging class, based on UNIX syslog interface.
Definition: Logger.h:1077
std::streampos length()
Return the length of the current message buffer.
Definition: Logger.h:1004
LogScheme & setShowFields(const std::vector< LogField > &fields)
Set the fields to show in log messages and their order.
Definition: Logger.cc:763
int line() const
Definition: Logger.h:424
LogScheme(const std::string &name="")
Construct a LogScheme with no LogConfig entries and show fields set to &quot;time,level,message&quot;.
Definition: Logger.cc:750
static bool knownScheme(const std::string &name)
Return true if the scheme with the given name is known, false otherwise.
Definition: Logger.cc:524
const int LOGGER_EMERG
Definition: Logger.h:166
void log(const std::string &msg) const
Convenience method which writes the given message to the current Logger instance, passing this object...
Definition: Logger.h:1326
LogMessage(const std::string &s="")
Create a LogMessage, optionally set to an initial string.
Definition: Logger.h:901
#define LOG_NOTICE
Definition: Logger.h:209
LogMessage(const LogContext *lp, const std::string &s="")
Associate this LogMessage with a LogContext.
Definition: Logger.h:940
Definition: Logger.h:632
void showLogPoints(bool show)
If show is true, then all the known log points will be listed in log messages, and all future log poi...
Definition: Logger.cc:1003
int stringToLogLevel(const std::string &slevel)
Convert the name of a log level to its integer value.
Definition: Logger.cc:1103
const std::string & getName() const
Definition: Logger.h:685
const char * filename() const
Definition: Logger.h:412
static LogField stringToField(const std::string &s)
Convert the name of a log information field to its enum, such as Logger::ThreadField.
Definition: Logger.cc:890
std::string getParameter(const std::string &name, const std::string &dvalue="")
Return the string value of the parameter with name name.
Definition: Logger.cc:947
LogMessage & operator=(const LogMessage &right)
Definition: Logger.h:955
static Logger * _instance
Definition: Logger.h:1283
std::string getMessage() const
Definition: Logger.h:966
const char * tags() const
Definition: Logger.h:436
void setTZ(const char *val)
Set the timezone to be used in the log messages, whether passed to syslog or formatted to include the...
Definition: Logger.cc:300
char * _ident
Definition: Logger.h:1290
void msg(const LogContext &lc, const LogMessage &m)
Definition: Logger.h:1185
std::string _name
Definition: Logger.h:876
LogScheme & addConfig(const LogConfig &lc)
Push a new LogConfig onto the list of existing configs.
Definition: Logger.cc:821
std::ostringstream msg
Definition: Logger.h:1026
LogContext(int level, const char *file, const char *function, int line, const char *tags=0)
The LogContext constructor initializes all the static context information, adds this context to the g...
Definition: Logger.cc:1025
std::map< std::string, std::string > _parameters
Definition: Logger.h:879
const int LOGGER_PROBLEM
Definition: Logger.h:173
std::vector< LogField > log_fields
Definition: Logger.h:878
void msg(const LogContext &lc, const std::string &msg)
Send a log message for the given LogContext lc.
Definition: Logger.cc:330
int level
For all matching log points, enable the log point if the log level is more severe (lower value) than ...
Definition: Logger.h:564
A C++ wrapper for a POSIX mutex.
Definition: ThreadSupport.h:154
LogScheme & clearConfigs()
Clear the set of LogConfig&#39;s in this scheme.
Definition: Logger.cc:812
LogMessage(const LogMessage &right)
Definition: Logger.h:947
LogMessage & format(const char *fmt,...)
Definition: Logger.cc:561
LogField
Definition: Logger.h:627
const int LOGGER_WARNING
Definition: Logger.h:174
std::string levelName() const
Definition: Logger.h:451
log_configs_v log_configs
Definition: Logger.h:877