nidas v1.2.3
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 <syslog.h>
31#include <pthread.h> // pthread_id
32#include <string>
33#include <sstream>
34#include <vector>
35#include <map>
36
37// define to thread_local to use C++11 thread_local storage for static
38// LogContext instances declared by the logging macros. if every LogContext
39// is in thread-local storage, then the active flag is only (almost) accessed
40// by one thread. if another thread changes the current LogScheme and
41// reconfigures all the log points, then that would be flagged by a
42// concurrency checker. however, in all nidas programs so far, the log scheme
43// is setup once at startup and never changed.
44#ifndef NIDAS_LOGGER_THREADLOCAL
45#define NIDAS_LOGGER_THREADLOCAL thread_local
46#endif
47
48// define to non-zero to guard all access to the LogContext active flag. this
49// is one way to prevent multiple threads from accessing the active flag of
50// the same LogContext instance, but it incurs the overhead (unmeasured) of
51// locking the logging mutex on every test of the active flag. it is here for
52// historical record but deprecated in favor of thread_local.
53#ifndef NIDAS_LOGGER_GUARD_ACTIVE
54#define NIDAS_LOGGER_GUARD_ACTIVE 0
55#endif
56
57namespace nidas { namespace util {
58
181 const int LOGGER_ERR = LOG_ERR;
188 const int LOGGER_NONE = LOG_EMERG-1;
191#undef LOG_EMERG
192#undef LOG_ALERT
193#undef LOG_CRIT
194#undef LOG_ERR
195#undef LOG_WARNING
196#undef LOG_NOTICE
197#undef LOG_INFO
198#undef LOG_DEBUG
199
200#define LOG_CONTEXT(LEVEL) \
201 nidas::util::LEVEL, __FILE__, __PRETTY_FUNCTION__, __LINE__
202
209#define LOG_STATIC_CONTEXT(LEVEL) \
210 nidas::util::LEVEL, __FILE__, "file_static_scope", __LINE__
211
212 // Redefine the log levels to be a full LogContext instance.
213#define LOG_EMERG LOG_CONTEXT(LOGGER_EMERG)
214#define LOG_ALERT LOG_CONTEXT(LOGGER_ALERT)
215#define LOG_CRIT LOG_CONTEXT(LOGGER_CRIT)
216#define LOG_ERR LOG_CONTEXT(LOGGER_ERR)
217#define LOG_WARNING LOG_CONTEXT(LOGGER_WARNING)
218#define LOG_NOTICE LOG_CONTEXT(LOGGER_NOTICE)
219#define LOG_INFO LOG_CONTEXT(LOGGER_INFO)
220#define LOG_DEBUG LOG_CONTEXT(LOGGER_DEBUG)
221#define LOG_VERBOSE LOG_CONTEXT(LOGGER_VERBOSE)
222
257#define LOGGER_LOGPOINT(LEVEL,TAGS,MSG) \
258 do { \
259 nidas::util::Logger::init(); \
260 static NIDAS_LOGGER_THREADLOCAL nidas::util::LogContext logctxt \
261 (nidas::util::LEVEL, __FILE__,__PRETTY_FUNCTION__, \
262 __LINE__,TAGS); \
263 if (logctxt.active()) \
264 logctxt.log(nidas::util::LogMessage().format MSG); } \
265 while (0)
266
309#define ELOG(MSG) LOGGER_LOGPOINT(LOGGER_EMERG,"",MSG)
310#define ALOG(MSG) LOGGER_LOGPOINT(LOGGER_ALERT,"",MSG)
311#define CLOG(MSG) LOGGER_LOGPOINT(LOGGER_CRITICAL,"",MSG)
312#define PLOG(MSG) LOGGER_LOGPOINT(LOGGER_ERR,"",MSG) // For Problem, as in Error
313#define WLOG(MSG) LOGGER_LOGPOINT(LOGGER_WARNING,"",MSG)
314#define NLOG(MSG) LOGGER_LOGPOINT(LOGGER_NOTICE,"",MSG)
315#define ILOG(MSG) LOGGER_LOGPOINT(LOGGER_INFO,"",MSG)
316#define DLOG(MSG) LOGGER_LOGPOINT(LOGGER_DEBUG,"",MSG)
317#define VLOG(MSG) LOGGER_LOGPOINT(LOGGER_VERBOSE,"",MSG)
318
319#define ELOGT(TAGS,MSG) LOGGER_LOGPOINT(LOGGER_EMERG,TAGS,MSG)
320#define ALOGT(TAGS,MSG) LOGGER_LOGPOINT(LOGGER_ALERT,TAGS,MSG)
321#define CLOGT(TAGS,MSG) LOGGER_LOGPOINT(LOGGER_CRITICAL,TAGS,MSG)
322#define PLOGT(TAGS,MSG) LOGGER_LOGPOINT(LOGGER_ERR,TAGS,MSG) // For Problem, as in Error
323#define WLOGT(TAGS,MSG) LOGGER_LOGPOINT(LOGGER_WARNING,TAGS,MSG)
324#define NLOGT(TAGS,MSG) LOGGER_LOGPOINT(LOGGER_NOTICE,TAGS,MSG)
325#define ILOGT(TAGS,MSG) LOGGER_LOGPOINT(LOGGER_INFO,TAGS,MSG)
326#define DLOGT(TAGS,MSG) LOGGER_LOGPOINT(LOGGER_DEBUG,TAGS,MSG)
327#define VLOGT(TAGS,MSG) LOGGER_LOGPOINT(LOGGER_VERBOSE,TAGS,MSG)
330 class Logger;
331 class LoggerPrivate;
332 class LogMessage;
333
338 int
339 stringToLogLevel(const std::string& slevel);
340
345 std::string
346 logLevelToString(int);
347
355 {
356 public:
357
362 LogContextState(int level, const char* file, const char* function,
363 int line, const char* tags = 0);
364
370 inline bool
371 active() const
372 {
373 return _active;
374 }
375
379 void
381 {
382 _active = active;
383 }
384
385 const char*
386 filename() const
387 {
388 return _file;
389 }
390
391 const char*
392 function() const
393 {
394 return _function;
395 }
396
397 int
398 line() const
399 {
400 return _line;
401 }
402
403 int
404 level() const
405 {
406 return _level;
407 }
408
409 const char*
410 tags() const
411 {
412 return _tags;
413 }
414
421 std::string
422 threadName() const;
423
424 std::string
425 levelName() const
426 {
427 return logLevelToString(_level);
428 }
429
445 inline void
446 log(const std::string& msg) const;
447
465 inline LogMessage
466 log() const;
467
468 protected:
470 const char* _file;
471 const char* _function;
472 int _line;
473 const char* _tags;
474
476
477 pthread_t _threadId;
478 };
479
531 {
532 public:
533
539 LogContext (int level, const char* file, const char* function, int line,
540 const char* tags = 0);
541
542#if NIDAS_LOGGER_GUARD_ACTIVE
543 bool
544 active() const;
545
546 void
547 setActive(bool active);
548#endif
549
554 ~LogContext();
555
563 LogContext(const LogContext&) = delete;
564 LogContext& operator=(const LogContext&) = delete;
565
568 };
569
570
587 {
588 public:
589
594 std::string filename_match;
595
600 std::string function_match;
601
606 std::string tag_match;
607
613 int line;
614
620 int level;
621
627
631 bool
632 matches(const LogContext& lc) const;
633
663 LogConfig&
664 parse(const std::string& text);
665
671 LogConfig(const std::string& text = "");
672 };
673
674
680 {
681 public:
682
694
698 typedef std::vector<LogConfig> log_configs_v;
699
705 static LogField
706 stringToField(const std::string& s);
707
712 static std::string
714
725 explicit
726 LogScheme(const std::string& name = "");
727
732 LogScheme&
733 setName(const std::string& name)
734 {
735 if (name.length() > 0)
736 _name = name;
737 return *this;
738 }
739
740 const std::string&
741 getName() const
742 {
743 return _name;
744 }
745
750 LogScheme&
751 clearConfigs();
752
769 LogScheme&
770 addConfig(const LogConfig& lc);
771
778 LogScheme&
779 addConfig(const std::string& config);
780
794 LogScheme&
795 addFallback(const LogConfig& lc);
796
797 LogScheme&
798 addFallback(const std::string& config);
799
805 getConfigs();
806
819 int
820 logLevel();
821
829 LogScheme&
830 setShowFields(const std::vector<LogField>& fields);
831
839 LogScheme&
840 setShowFields(const std::string& fields);
841
846 std::string
847 getShowFieldsString () const;
848
852 bool
853 parseParameter(const std::string& text);
854
858 void
859 setParameter(const std::string& name, const std::string& value);
860
867 std::string
868 getParameter(const std::string& name, const std::string& dvalue="");
869
898 template <typename T>
899 T
900 getParameterT(const std::string& name, const T& dvalue = T());
901
907 std::string
908 getEnvParameter(const std::string& name, const std::string& dvalue="");
909
915 void
916 showLogPoints(bool show);
917
921 bool
923 {
924 return _showlogpoints;
925 }
926
927 private:
928
929 void
930 show_log_point(const LogContextState& lp) const;
931
932 std::string _name;
934 std::vector<LogField> log_fields;
935 std::map<std::string, std::string> _parameters;
938
942 };
943
944
952 {
953 public:
957 LogMessage(const std::string& s = "") :
958 msg(),
959 _log_context(0)
960 {
961 msg << s;
962 }
963
996 LogMessage(const LogContextState* lp, const std::string& s = "") :
997 msg(),
998 _log_context(lp)
999 {
1000 msg << s;
1001 }
1002
1003 LogMessage(const LogMessage& right) :
1004 msg(),
1006 {
1007 msg << right.msg.str();
1008 }
1009
1010 LogMessage&
1011 operator=(const LogMessage& right)
1012 {
1013 msg << right.msg.str();
1014 _log_context = right._log_context;
1015 return *this;
1016 }
1017
1018 LogMessage&
1019 format(const char *fmt, ...);
1020
1021 std::string
1023 {
1024 return msg.str();
1025 }
1026
1027 operator std::string () const
1028 {
1029 return msg.str();
1030 }
1031
1032 template <typename T>
1033 LogMessage&
1034 operator<< (const T& t);
1035
1042 {
1043 log();
1044 }
1045
1059 inline std::streampos
1061 {
1062 return msg.tellp();
1063 }
1064
1070 void
1072 {
1073 if (_log_context && length() > 0)
1074 {
1075 _log_context->log(*this);
1076 }
1077 msg.str("");
1078 msg.clear();
1079 }
1080
1081 private:
1082 std::ostringstream msg;
1084 };
1085
1086
1091 template <typename T>
1092 inline
1095 operator<< (const T& t)
1096 {
1097 msg << t;
1098 return *this;
1099 }
1100
1101
1106 inline LogMessage&
1108 {
1109 logmsg.log();
1110 return logmsg;
1111 }
1112
1118 operator<<(LogMessage& logmsg, LogMessage& (*op)(LogMessage&))
1119 {
1120 return (*op)(logmsg);
1121 }
1122
1133 class Logger {
1134 protected:
1135 Logger(const std::string& ident, int logopt, int facility,
1136 const char *TZ = 0);
1137 Logger(std::ostream* );
1138 Logger();
1139
1140 public:
1141
1150 static Logger*
1151 createInstance(const std::string& ident, int logopt, int facility,
1152 const char *TZ = 0);
1153
1161 static Logger* createInstance(std::ostream* out = 0);
1162
1186 static Logger* getInstance();
1187
1194 static void
1196
1200 static void
1201 init();
1202
1219 void
1220 log(int severity, const char* file, const char* fn,
1221 int line, const char *fmt, ...);
1222
1235 void
1236 msg(const LogContextState& lc, const std::string& msg);
1237
1238 inline void
1239 msg(const LogContextState& lc, const LogMessage& m)
1240 {
1241 msg (lc, m.getMessage());
1242 }
1243
1267 static void
1268 setScheme(const std::string& name);
1269
1274 static void
1275 setScheme(const LogScheme& scheme);
1276
1284 static void
1285 updateScheme(const LogScheme& scheme);
1286
1294 static LogScheme
1295 getScheme(const std::string& name);
1296
1301 static LogScheme
1302 getScheme();
1303
1312 static bool
1313 knownScheme(const std::string& name);
1314
1319 static void
1320 clearSchemes();
1321
1324 protected:
1335 void setTZ(const char* val);
1336
1338
1339 std::ostream* _output;
1341
1343 char* _saveTZ;
1344 char* _ident;
1345
1346 private:
1347
1354 static Logger*
1355 get_instance_locked(std::ostream* out = 0);
1356
1360
1361 ~Logger();
1362
1365
1368 };
1369
1370 inline void
1372 log(const std::string& msg) const
1373 {
1374 Logger::getInstance()->msg(*this, msg);
1375 }
1376
1377 inline LogMessage
1379 log() const
1380 {
1381 return LogMessage(this);
1382 }
1383
1384 template <typename T>
1385 T
1387 getParameterT(const std::string& name, const T& dvalue)
1388 {
1389 // A rudimentary implementation which converts strings
1390 // to the given type.
1391 T value;
1392 std::istringstream text(getParameter(name));
1393 text >> value;
1394 if (text.fail())
1395 value = dvalue;
1396 return value;
1397 }
1398
1401}} // namespace nidas namespace util
1402
1403#endif
A configuration to enable or disable a matching set of log points.
Definition Logger.h:587
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:632
int line
Apply this config to log points with the given line number.
Definition Logger.h:613
LogConfig(const std::string &text="")
Construct a default LogConfig which matches and enables every log point with level DEBUG or higher.
Definition Logger.cc:576
int level
For all matching log points, enable the log point if the log level is more severe (lower value) than ...
Definition Logger.h:620
std::string tag_match
Apply this config to log points whose tags include this tag.
Definition Logger.h:606
bool activate
If true, then all matching log points will be enabled.
Definition Logger.h:626
bool matches(const LogContext &lc) const
Return true if this config matches the given LogContext lc.
Definition Logger.cc:590
std::string function_match
Apply this config to log points in functions which contain the given string.
Definition Logger.h:600
std::string filename_match
Apply this config to log points in filenames which contain the given string.
Definition Logger.h:594
LogContextState holds the status members of a LogContext and related behavior.
Definition Logger.h:355
int _level
Definition Logger.h:469
int line() const
Definition Logger.h:398
LogContextState(int level, const char *file, const char *function, int line, const char *tags=0)
The LogContextState constructor initializes all the static context information and also records the I...
Definition Logger.cc:1035
std::string levelName() const
Definition Logger.h:425
const char * filename() const
Definition Logger.h:386
std::string threadName() const
Return the name of the thread which created this context.
Definition Logger.cc:1083
int _line
Definition Logger.h:472
void setActive(bool active)
Enable this log point according to active.
Definition Logger.h:380
int level() const
Definition Logger.h:404
pthread_t _threadId
Definition Logger.h:477
const char * _file
Definition Logger.h:470
const char * tags() const
Definition Logger.h:410
const char * _tags
Definition Logger.h:473
const char * function() const
Definition Logger.h:392
const char * _function
Definition Logger.h:471
bool _active
Definition Logger.h:475
bool active() const
Return true if log messages from this context have been enabled.
Definition Logger.h:371
The LogContext is created at a point in the application code and filled in with details about that lo...
Definition Logger.h:531
~LogContext()
Since the constructor registers this context with the global log points, the destructor unregisters i...
Definition Logger.cc:1091
LogContext(int level, const char *file, const char *function, int line, const char *tags=0)
Initialize LogContextState with the static context information, then add this context to the global r...
Definition Logger.cc:1044
LogContext & operator=(const LogContext &)=delete
LogContext(const LogContext &)=delete
LogContext allocates a resource: it's registration with the global log points.
A class for formatting and streaming a log message.
Definition Logger.h:952
LogMessage & operator=(const LogMessage &right)
Definition Logger.h:1011
std::streampos length()
Return the length of the current message buffer.
Definition Logger.h:1060
~LogMessage()
If this message was associated with a LogContext, then send the completed message to it when this ins...
Definition Logger.h:1041
LogMessage(const std::string &s="")
Create a LogMessage, optionally set to an initial string.
Definition Logger.h:957
const LogContextState * _log_context
Definition Logger.h:1083
void log()
If this LogMessage is associated with a LogContext and if the current message is not empty,...
Definition Logger.h:1071
LogMessage(const LogContextState *lp, const std::string &s="")
Associate this LogMessage with a LogContext.
Definition Logger.h:996
std::string getMessage() const
Definition Logger.h:1022
LogMessage & format(const char *fmt,...)
Definition Logger.cc:556
std::ostringstream msg
Definition Logger.h:1082
LogMessage(const LogMessage &right)
Definition Logger.h:1003
A LogScheme is a vector of LogConfig's and the vector of fields to show in log messages.
Definition Logger.h:680
bool _fallbacks
Definition Logger.h:937
std::string _name
Definition Logger.h:932
static std::string fieldToString(LogScheme::LogField lf)
Convert a LogField to its lower-case string name.
Definition Logger.cc:899
log_configs_v getConfigs()
Return a copy of the LogConfig instances added to this LogScheme.
Definition Logger.cc:859
int logLevel()
Return the highest level of log messages enabled in all the LogConfig instances added to this LogSche...
Definition Logger.cc:867
log_configs_v log_configs
Definition Logger.h:933
bool getShowLogPoints()
Return true if showLogPoints() is enabled.
Definition Logger.h:922
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:1002
LogScheme(const std::string &name="")
Construct a LogScheme with no LogConfig entries and show fields set to "time,level,...
Definition Logger.cc:745
bool _showlogpoints
Definition Logger.h:936
LogScheme & setName(const std::string &name)
LogScheme names must not be empty, so this method has no effect unless name.length() > 0.
Definition Logger.h:733
const std::string & getName() const
Definition Logger.h:741
LogScheme & addConfig(const LogConfig &lc)
Push a new LogConfig onto the list of existing configs.
Definition Logger.cc:816
void setParameter(const std::string &name, const std::string &value)
Set a parameter for this scheme.
Definition Logger.cc:934
LogScheme & clearConfigs()
Clear the set of LogConfig's in this scheme.
Definition Logger.cc:807
std::vector< LogField > log_fields
Definition Logger.h:934
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:885
std::vector< LogConfig > log_configs_v
The type for the vector of LogConfigs returned by getConfigs().
Definition Logger.h:698
std::string getShowFieldsString() const
Return a comma-separated string describing the list of fields to be shown by this scheme.
Definition Logger.cc:793
LogScheme & setShowFields(const std::vector< LogField > &fields)
Set the fields to show in log messages and their order.
Definition Logger.cc:758
std::string getParameter(const std::string &name, const std::string &dvalue="")
Return the string value of the parameter with name name.
Definition Logger.cc:942
std::map< std::string, std::string > _parameters
Definition Logger.h:935
LogField
Definition Logger.h:684
@ AllFields
Definition Logger.h:692
@ NoneField
Definition Logger.h:685
@ LevelField
Definition Logger.h:689
@ TimeField
Definition Logger.h:691
@ FunctionField
Definition Logger.h:687
@ FileField
Definition Logger.h:688
@ MessageField
Definition Logger.h:690
@ ThreadField
Definition Logger.h:686
LogScheme & addFallback(const LogConfig &lc)
Add a fallback LogConfig.
Definition Logger.cc:838
std::string getEnvParameter(const std::string &name, const std::string &dvalue="")
Return the value of the parameter.
Definition Logger.cc:956
void show_log_point(const LogContextState &lp) const
Log a message about the existence and state of the given LogContext @lp.
Definition Logger.cc:982
bool parseParameter(const std::string &text)
Parse a parameter setting using syntax <name>=.
Definition Logger.cc:913
Definition Logger.cc:149
Simple logging class, based on UNIX syslog interface.
Definition Logger.h:1133
char * _saveTZ
Definition Logger.h:1343
static Logger * get_instance_locked(std::ostream *out=0)
Return the current instance or create a default, without locking.
Definition Logger.cc:297
static Logger * _instance
Definition Logger.h:1337
char * _ident
Definition Logger.h:1344
char * _loggerTZ
Definition Logger.h:1342
Logger(const Logger &)
No copying.
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:325
static void destroyInstance()
Destroy any existing Logger instance.
Definition Logger.cc:260
static Logger * createInstance(const std::string &ident, int logopt, int facility, const char *TZ=0)
Create a syslog-type Logger.
Definition Logger.cc:285
void msg(const LogContextState &lc, const LogMessage &m)
Definition Logger.h:1239
void msg(const LogContextState &lc, const std::string &msg)
Send a log message for the given LogContext lc.
Definition Logger.cc:355
void log(int severity, const char *file, const char *fn, int line, const char *fmt,...)
Build a message from a printf-format string and variable args, and log the message.
Definition Logger.cc:455
Logger()
Definition Logger.cc:239
~Logger()
Definition Logger.cc:248
bool _syslogit
Definition Logger.h:1340
static void init()
Initializes the logging implementation.
Definition Logger.cc:270
std::ostream * _output
Definition Logger.h:1339
Logger & operator=(const Logger &)
No assignment.
static Logger * getInstance()
Retrieve the current Logger singleton instance.
Definition Logger.cc:318
const int LOGGER_EMERGENCY
Definition Logger.h:176
const int LOGGER_DEBUG
Definition Logger.h:186
const int LOGGER_VERBOSE
Definition Logger.h:187
const int LOGGER_PROBLEM
Definition Logger.h:182
const int LOGGER_ERROR
Definition Logger.h:180
const int LOGGER_INFO
Definition Logger.h:185
const int LOGGER_EMERG
Definition Logger.h:175
const int LOGGER_WARNING
Definition Logger.h:183
const int LOGGER_CRIT
Definition Logger.h:178
const int LOGGER_CRITICAL
Definition Logger.h:179
const int LOGGER_NOTICE
Definition Logger.h:184
const int LOGGER_ERR
Definition Logger.h:181
const int LOGGER_ALERT
Definition Logger.h:177
const int LOGGER_NONE
Definition Logger.h:188
static LogScheme getScheme()
Return the current LogScheme, creating the default LogScheme if it has not been set yet.
Definition Logger.cc:508
static bool knownScheme(const std::string &name)
Return true if the scheme with the given name is known, false otherwise.
Definition Logger.cc:517
static void clearSchemes()
Erase all known schemes and reset the active scheme to the name initialized at application start.
Definition Logger.cc:540
static void updateScheme(const LogScheme &scheme)
Update or insert this scheme in the collection of log schemes.
Definition Logger.cc:526
static void setScheme(const std::string &name)
Set the current scheme.
Definition Logger.cc:478
LogMessage & operator<<(const T &t)
Everything streamed to a LogMessage is passed on to the underlying ostringstream, including ostream m...
Definition Logger.h:1095
#define LOG_ALERT
Definition Logger.h:214
LogMessage & operator<<(LogMessage &logmsg, LogMessage &(*op)(LogMessage &))
Template to call LogMessage manipulators like endlog when streamed to a LogMessage.
Definition Logger.h:1118
LogMessage & endlog(LogMessage &logmsg)
LogMessage manipulator which logs the current message buffer, if any, and then clears the message.
Definition Logger.h:1107
#define LOG_EMERG
Definition Logger.h:213
string logLevelToString(int level)
Convert an integral log level to a string name.
Definition Logger.cc:1144
#define LOG_DEBUG
Definition Logger.h:220
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:1387
int stringToLogLevel(const std::string &slevel)
Convert the name of a log level to its integer value.
Definition Logger.cc:1129
#define LOG_ERR
Definition Logger.h:216
#define LOG_CRIT
Definition Logger.h:215
#define LOG_NOTICE
Definition Logger.h:218
#define LOG_WARNING
Definition Logger.h:217
#define LOG_INFO
Definition Logger.h:219
LogMessage log() const
Return a LogMessage associated with this LogContextState, so the message will be logged through this ...
Definition Logger.h:1379
Root namespace for the NCAR In-Situ Data Acquisition Software.
Definition A2DConverter.h:31