journaller.h
Go to the documentation of this file.
1 
2 // Copyright (c) 2003-2021 Xsens Technologies B.V. or subsidiaries worldwide.
3 // All rights reserved.
4 //
5 // Redistribution and use in source and binary forms, with or without modification,
6 // are permitted provided that the following conditions are met:
7 //
8 // 1. Redistributions of source code must retain the above copyright notice,
9 // this list of conditions, and the following disclaimer.
10 //
11 // 2. Redistributions in binary form must reproduce the above copyright notice,
12 // this list of conditions, and the following disclaimer in the documentation
13 // and/or other materials provided with the distribution.
14 //
15 // 3. Neither the names of the copyright holders nor the names of their contributors
16 // may be used to endorse or promote products derived from this software without
17 // specific prior written permission.
18 //
19 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
20 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
21 // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
22 // THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 // SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
24 // OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR
26 // TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.THE LAWS OF THE NETHERLANDS
28 // SHALL BE EXCLUSIVELY APPLICABLE AND ANY DISPUTES SHALL BE FINALLY SETTLED UNDER THE RULES
29 // OF ARBITRATION OF THE INTERNATIONAL CHAMBER OF COMMERCE IN THE HAGUE BY ONE OR MORE
30 // ARBITRATORS APPOINTED IN ACCORDANCE WITH SAID RULES.
31 //
32 
33 
34 // Copyright (c) 2003-2021 Xsens Technologies B.V. or subsidiaries worldwide.
35 // All rights reserved.
36 //
37 // Redistribution and use in source and binary forms, with or without modification,
38 // are permitted provided that the following conditions are met:
39 //
40 // 1. Redistributions of source code must retain the above copyright notice,
41 // this list of conditions, and the following disclaimer.
42 //
43 // 2. Redistributions in binary form must reproduce the above copyright notice,
44 // this list of conditions, and the following disclaimer in the documentation
45 // and/or other materials provided with the distribution.
46 //
47 // 3. Neither the names of the copyright holders nor the names of their contributors
48 // may be used to endorse or promote products derived from this software without
49 // specific prior written permission.
50 //
51 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
52 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
53 // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
54 // THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
55 // SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
56 // OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
57 // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR
58 // TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
59 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.THE LAWS OF THE NETHERLANDS
60 // SHALL BE EXCLUSIVELY APPLICABLE AND ANY DISPUTES SHALL BE FINALLY SETTLED UNDER THE RULES
61 // OF ARBITRATION OF THE INTERNATIONAL CHAMBER OF COMMERCE IN THE HAGUE BY ONE OR MORE
62 // ARBITRATORS APPOINTED IN ACCORDANCE WITH SAID RULES.
63 //
64 
65 #ifndef JOURNALLERBASE_H
66 #define JOURNALLERBASE_H
67 
68 #include "journalloglevel.h"
70 #include <sstream>
71 #ifndef JL_NOTEMPLATE
72  #include <iomanip>
73 #endif
74 #include <xstypes/xsstring.h>
75 #include <memory>
76 
77 class JournalFile;
78 class JournalThreader;
80 {
81 public:
82  Journaller(const XsString& pathfile, bool purge = true, JournalLogLevel initialLogLevel = JLL_Alert);
83  ~Journaller();
84 
85  void log(JournalLogLevel level, const std::string& msg);
86  void writeCallstack(JournalLogLevel level);
87 
88  void setLogLevel(JournalLogLevel level, bool writeLogLine = true);
89 
91  inline JournalLogLevel logLevel() const
92  {
93  return m_level;
94  }
95 
100  inline bool logLevel(JournalLogLevel level) const
101  {
102  return level >= m_level || level >= m_debugLevel;
103  }
104 
105  void setDebugLevel(JournalLogLevel level, bool writeLogLine = true);
106 
109  {
110  return m_debugLevel;
111  }
112 
113  void setFlushLevel(JournalLogLevel level, bool writeLogLine = true);
114 
117  {
118  return m_flushLevel;
119  }
120 
121  void writeFileHeader(const std::string& appName);
122  void setUseDateTime(bool yes);
123 
124  void writeTime();
125  void writeThread();
126  void writeTag();
127  void writeLevel(JournalLogLevel level);
128  void writeMessage(const std::string& msg);
129  void flush();
130  void cleanupThread();
131 
132  const XsString filename() const;
133 
134  void setTag(const std::string& tag);
135  std::string tag() const;
136 
138 
140  inline static bool hasAdditionalLogger()
141  {
142  return m_additionalLogger != nullptr;
143  }
144 
147  {
148  return m_additionalLogger;
149  }
150 
151  static std::string tagFromFilename(const std::string& fn);
152  void moveLogFile(const XsString& pathfile, bool purge = true, bool eraseOld = true);
153  void moveLogs(Journaller* target, bool eraseOld = true);
154 
155 private:
156  void init(XsString const& pathfile, bool purge);
157  void flushLine();
158 
159  std::shared_ptr<JournalFile> m_file;
160  std::string m_tag;
161  std::string m_appName;
165  std::shared_ptr<JournalThreader> m_threader;
166 
168 
170 
171  // no copying allowed
172  Journaller& operator = (Journaller const&) = delete;
173  Journaller(Journaller const&) = delete;
174 };
175 
176 #if 1 && (defined(MSC_VER) || 1) // add exceptions to compilers here that do not (yet) support constexpr. These will fall back to the full path. If the first 1 is set to 0, no path stripping will be done in any case.
177 inline static constexpr char const* jlStrippedPath(char const* a, char const* b)
178 {
179  return (a[0] ? (a[0] == '/' || a[0] == '\\' ? jlStrippedPath(a + 1, a + 1) : jlStrippedPath(a + 1, b)) : b);
180 }
181 inline static constexpr char const* jlStrippedPathFile(char const* a)
182 {
183  return jlStrippedPath(a, a);
184 }
185 #define STRIPPEDFILE jlStrippedPathFile(__FILE__)
186 #else
187 #define STRIPPEDFILE __FILE__
188 #endif
189 
190 #if !defined(JLNOLINEINFO)
191  #define JLGENERIC_LINEINFO STRIPPEDFILE << "(" << __LINE__ << ") "
192 #else
193  #define JLGENERIC_LINEINFO ""
194 #endif
195 
196 #define JLGENERIC(journal, level, msg)\
197  do { /*lint --e{506}*/ \
198  if (journal && journal->logLevel(level)) \
199  { \
200  std::ostringstream os; \
201  os << JLGENERIC_LINEINFO << __FUNCTION__ << " " << msg; \
202  journal->log(level, os.str()); \
203  } \
204  if (Journaller::hasAdditionalLogger() && Journaller::additionalLogger()->logLevel(level)) \
205  { \
206  std::ostringstream os; \
207  os << msg; \
208  Journaller::additionalLogger()->log(level, STRIPPEDFILE, __LINE__, __FUNCTION__, os.str()); \
209  } \
210  } while(0)
211 
212 #define JLGENERIC_NODEC(journal, level, msg)\
213  do { \
214  if (journal && journal->logLevel(level)) \
215  { \
216  std::ostringstream os; \
217  os << msg << '\n'; \
218  journal->writeMessage(os.str()); \
219  } \
220  if (Journaller::hasAdditionalLogger() && Journaller::additionalLogger()->logLevel(level)) \
221  { \
222  std::ostringstream os; \
223  os << msg << '\n'; \
224  Journaller::additionalLogger()->logNoDecoration(level, STRIPPEDFILE, __LINE__, __FUNCTION__, os.str()); \
225  } \
226  } while(0)
227 
228 #if !defined(JLDEBUG)
229 
230  #if JLDEF_BUILD > JLL_TRACE
231  #define JLTRACE(...) ((void)0)
232  #define JLTRACE_NODEC(...) ((void)0)
233  #else
234  #define JLTRACE(journal, msg) JLGENERIC(journal, JLL_Trace, msg)
235  #define JLTRACE_NODEC(journal, msg) JLGENERIC_NODEC(journal, JLL_Trace, msg)
236  #endif
237 
238  #if JLDEF_BUILD > JLL_DEBUG
239  #define JLDEBUG(...) ((void)0)
240  #define JLDEBUG_NODEC(...) ((void)0)
241  #else
242  #define JLDEBUG(journal, msg) JLGENERIC(journal, JLL_Debug, msg)
243  #define JLDEBUG_NODEC(journal, msg) JLGENERIC_NODEC(journal, JLL_Debug, msg)
244  #endif
245 
246  #if JLDEF_BUILD > JLL_ALERT
247  #define JLALERT(...) ((void)0)
248  #define JLALERT_NODEC(...) ((void)0)
249  #else
250  #define JLALERT(journal, msg) JLGENERIC(journal, JLL_Alert, msg)
251  #define JLALERT_NODEC(journal, msg) JLGENERIC_NODEC(journal, JLL_Alert, msg)
252  #endif
253 
254  #if JLDEF_BUILD > JLL_ERROR
255  #define JLERROR(...) ((void)0)
256  #define JLERROR_NODEC(...) ((void)0)
257  #else
258  #define JLERROR(journal, msg) JLGENERIC(journal, JLL_Error, msg)
259  #define JLERROR_NODEC(journal, msg) JLGENERIC_NODEC(journal, JLL_Error, msg)
260  #endif
261 
262  #if JLDEF_BUILD > JLL_FATAL
263  #define JLFATAL(...) ((void)0)
264  #define JLFATAL_NODEC(...) ((void)0)
265  #else
266  #define JLFATAL(journal, msg) JLGENERIC(journal, JLL_Fatal, msg)
267  #define JLFATAL_NODEC(journal, msg) JLGENERIC_NODEC(journal, JLL_Fatal, msg)
268  #endif
269 
270  #if JLDEF_BUILD > JLL_WRITE
271  #define JLWRITE(...) ((void)0)
272  #define JLWRITE_NODEC(...) ((void)0)
273  #else
274  #define JLWRITE(journal, msg) JLGENERIC(journal, JLL_Write, msg)
275  #define JLWRITE_NODEC(journal, msg) JLGENERIC_NODEC(journal, JLL_Write, msg)
276  #endif
277 
278  // some convenience macros, since we almost always use a global gJournal Journaller
279  #define JLTRACEG(msg) JLTRACE(gJournal, msg)
280  #define JLDEBUGG(msg) JLDEBUG(gJournal, msg)
281  #define JLALERTG(msg) JLALERT(gJournal, msg)
282  #define JLERRORG(msg) JLERROR(gJournal, msg)
283  #define JLFATALG(msg) JLFATAL(gJournal, msg)
284  #define JLWRITEG(msg) JLWRITE(gJournal, msg)
285 
286  // these can be used to log the final result of a value when leaving the function.
287  // use JLWRITEFINALG(myvar); or JLDEBUGFINALG(myvar); at the start of your function
288  #define JLFINALNAME(a) #a ": "
289  #define JLFINALVALUE(journal, level, a) JournalValueJanitor<decltype(a)> jlFinalValue ## a(journal, a, [](char const* fi, char const* fu, char const* va) { std::stringstream os; os << fi << " " << fu << " exit " << va; return os.str(); }(__FILE__, __FUNCTION__, JLFINALNAME(a)), level, true)
290  #define JLWRITEFINAL(journal, a) JLFINALVALUE(journal, JLL_Write, a)
291  #define JLWRITEFINALG(a) JLWRITEFINAL(gJournal, a)
292  #define JLDEBUGFINAL(journal, a) JLFINALVALUE(journal, JLL_Debug, a)
293  #define JLDEBUGFINALG(a) JLDEBUGFINAL(gJournal, a)
294 
295 #endif
296 
297 #ifndef _lint //pclint defines this
298  #define JLIF(journal, level, todo) do { if (journal && journal->logLevel(level)) { todo; } } while(0)
299 #else
300  #define JLIF(...) ((void)0)
301 #endif
302 
303 #ifndef JL_NOTEMPLATE
304 
308 template <typename T>
310 {
311 public:
313 
316  explicit JlHexLogger(T i)
317  : m_value(i)
318  {
319  }
320 };
321 
322 template <typename T>
323 std::ostream& operator << (std::ostream& os, JlHexLogger<T> const& hex)
324 {
325  std::ios_base::fmtflags f = os.flags();
326  os << std::hex << std::uppercase << hex.m_value << std::setiosflags(f);
327  return os;
328 }
329 template <> std::ostream& operator << (std::ostream& os, JlHexLogger<char> const& hex);
330 
331 #define JLHEXLOG_BARE(d) JlHexLogger<decltype(d)>(d) // C++0x11 only!
332 #else
333 #define JLHEXLOG_BARE(d) std::hex << std::uppercase << (int) d << std::nouppercase << std::dec
334 #endif
335 #define JLHEXLOG(d) "0x" << JLHEXLOG_BARE(d)
336 #define JLVARLOG(a) #a ": " << a << " "
337 
338 #define JLPRECISE2(msg, prec)\
339  [&](){\
340  std::ostringstream os; \
341  os.precision(prec); \
342  os << msg; \
343  return os.str();\
344  }()
345 #define JLPRECISE(msg) JLPRECISE2(msg, 16)
346 
347 #define JLCASE2(s, a, b) case a: s << b << "(" << static_cast<int>(a) << ")"; break;
348 #define JLCASE(s, a) case a: s << #a << "(" << static_cast<int>(a) << ")"; break;
349 #define JLDEFAULTCASE(s) default: s << "Unknown case: " << static_cast<int>(e); break;
350 #define JLENUMEXPPROTO(E) std::ostream& operator << (std::ostream& dbg, E const& e)
351 #define JLENUMEXPHDR(E, ...) JLENUMEXPPROTO(E) { __VA_ARGS__ switch(e) {
352 #define JLENUMCASE(a) JLCASE(dbg, a)
353 #define JLENUMCASE2(a, b) JLCASE2(dbg, a, b)
354 #define JLENUMEXPFTR(...) JLDEFAULTCASE(dbg) } __VA_ARGS__ return dbg; }
355 
357 #define JLENUMEXPANDER(E, items) JLENUMEXPHDR(E) items JLENUMEXPFTR()
358 
361 #define JLENUMEXPANDERHEX(E, items) JLENUMEXPHDR(E, dbg << std::hex << std::uppercase;) items JLENUMEXPFTR(dbg << std::dec << std::nouppercase;)
362 
365 #define JLENUMEXPANDERBITS(E, items) JLENUMEXPPROTO(E) { bool first = true; dbg << std::hex << std::uppercase << static_cast<int>(e) << "="; items if (first) dbg << "<None>"; dbg << std::dec << std::nouppercase; return dbg; }
366 #define JLENUMCASEBITS(a) if ((static_cast<int>(e) & static_cast<int>(a)) == static_cast<int>(a)) { if (first) first = false; else dbg << " | "; dbg << #a << "(" << static_cast<int>(a) << ")"; }
367 #define JLENUMCASEBITSNONE(a) if (first) { dbg << #a << "(0)"; first = false; }
368 
369 #define JLQTDEBUGHANDLER \
370  QtMessageHandler gOldQtMessageHandler = nullptr; \
371  Journaller* qtJournal = nullptr; \
372  QtMessageHandler qtChecker = nullptr; \
373  void jlQtMessageHandler(QtMsgType type, const QMessageLogContext &context, const QString &msg) {\
374  if (qtChecker) qtChecker(type, context, msg); \
375  if (!qtJournal) return;\
376  switch (type) {\
377  case QtDebugMsg:\
378  JLDEBUG(qtJournal, (const char *)msg.toLatin1());\
379  break;\
380  case QtWarningMsg:\
381  JLALERT(qtJournal, (const char *)msg.toLatin1());\
382  break;\
383  case QtCriticalMsg:\
384  JLERROR(qtJournal, (const char *)msg.toLatin1());\
385  break;\
386  case QtFatalMsg:\
387  JLFATAL(qtJournal, (const char *)msg.toLatin1());\
388  abort();\
389  default:\
390  break;\
391  }\
392  if (gOldQtMessageHandler)\
393  gOldQtMessageHandler(type,context,msg);\
394  }
395 
396 #define JLINSTALLQTDEBUGHANDLER(journal) \
397  qtJournal = journal;\
398  if (journal) {\
399  if (gOldQtMessageHandler == NULL) gOldQtMessageHandler = qInstallMessageHandler(jlQtMessageHandler);\
400  else qInstallMessageHandler(jlQtMessageHandler);\
401  } else if (gOldQtMessageHandler) {\
402  qInstallMessageHandler(gOldQtMessageHandler);\
403  gOldQtMessageHandler = NULL;\
404  }
405 
407 
414 template <typename T = int>
416 {
417 private:
419 
421  const T& m_value;
422  std::string m_msg;
424 public:
425  bool m_enabled;
426 
429  JournalValueJanitor<T>(Journaller* journal, const T& value, const std::string& msg = std::string(), JournalLogLevel level = JLL_Debug, bool enabled = true)
430  : m_journal(journal)
431  , m_value(value)
432  , m_msg(msg)
433  , m_level(level)
434  , m_enabled(enabled && journal)
435  {}
436 
440  {
441  if (m_enabled)
442  {
443  std::stringstream os;
444  os << m_msg << m_value;
445  m_journal->log(m_level, os.str());
446  }
447  }
448 };
449 
450 void jlTerminate(Journaller** gj);
451 
452 #endif
JournalValueJanitor::~JournalValueJanitor
~JournalValueJanitor()
Destructor.
Definition: journaller.h:439
xsstring.h
Journaller::writeFileHeader
void writeFileHeader(const std::string &appName)
Write a header for the log file including some meta-data about the journaller.
Definition: journaller.cpp:190
journalloglevel.h
Journaller::setAdditionalLogger
static void setAdditionalLogger(AbstractAdditionalLogger *additionalLogger)
Sets the additional logger.
Definition: journaller.cpp:172
msg
msg
Journaller::m_debugLevel
JournalLogLevel m_debugLevel
Definition: journaller.h:163
Journaller::m_tag
std::string m_tag
Definition: journaller.h:160
Journaller::flushLevel
JournalLogLevel flushLevel() const
Definition: journaller.h:116
Journaller::cleanupThread
void cleanupThread()
Removes stored information on the current thread after flushing all data.
Definition: journaller.cpp:491
JournalValueJanitor::m_value
const T & m_value
Definition: journaller.h:421
Journaller::moveLogFile
void moveLogFile(const XsString &pathfile, bool purge=true, bool eraseOld=true)
Move the log file to the supplied path, keeping current contents intact.
Definition: journaller.cpp:398
Journaller::writeTime
void writeTime()
Write the current time to the file.
Definition: journaller.cpp:224
JournalLogLevel
JournalLogLevel
Definition: journalloglevel.h:88
Journaller::moveLogs
void moveLogs(Journaller *target, bool eraseOld=true)
Copy the contents of the current log file to target.
Definition: journaller.cpp:451
Journaller::logLevel
bool logLevel(JournalLogLevel level) const
Compares a log/debug level with a set one.
Definition: journaller.h:100
jlStrippedPathFile
static constexpr char const * jlStrippedPathFile(char const *a)
Definition: journaller.h:181
JlHexLogger::m_value
T m_value
A hex value.
Definition: journaller.h:312
Journaller::setUseDateTime
void setUseDateTime(bool yes)
When setting the Date Time to yes, the timestamps are translated from unix timestamp into a redable d...
Definition: journaller.cpp:162
AbstractAdditionalLogger
Definition: abstractadditionallogger.h:74
Journaller::~Journaller
~Journaller()
Destructor, detaches from the logfile and closes it if this was the last reference.
Definition: journaller.cpp:133
Journaller::logLevel
JournalLogLevel logLevel() const
Definition: journaller.h:91
jlTerminate
void jlTerminate(Journaller **gj)
Cleans up any remaining stuff.
Definition: journaller.cpp:505
Journaller::writeMessage
void writeMessage(const std::string &msg)
Write msg to the file without decoration or added newline.
Definition: journaller.cpp:276
JLL_Alert
@ JLL_Alert
only log fatal, error and alert messages
Definition: journalloglevel.h:92
JournalValueJanitor::m_enabled
bool m_enabled
Boolean value if set to true then the janitor is enabled.
Definition: journaller.h:425
f
f
JournalFile
A class containing a journal file and some meta-data.
Definition: journalfile.h:73
JLL_Debug
@ JLL_Debug
log all messages, except function entry/exit (trace)
Definition: journalloglevel.h:91
Journaller
A journalling class for debugging applications.
Definition: journaller.h:79
JournalValueJanitor
Class for journalling a referenced value when the janitor leaves scope.
Definition: journaller.h:415
JournalValueJanitor::m_journal
Journaller * m_journal
Definition: journaller.h:420
Journaller::m_appName
std::string m_appName
Definition: journaller.h:161
Journaller::m_flushLevel
JournalLogLevel m_flushLevel
Definition: journaller.h:164
Journaller::m_file
std::shared_ptr< JournalFile > m_file
Definition: journaller.h:159
jlStrippedPath
static constexpr char const * jlStrippedPath(char const *a, char const *b)
Definition: journaller.h:177
JlHexLogger
A support class of journaller that is used for the logging of hex values.
Definition: journaller.h:309
Journaller::m_threader
std::shared_ptr< JournalThreader > m_threader
Definition: journaller.h:165
Journaller::m_additionalLogger
static AbstractAdditionalLogger * m_additionalLogger
The optional additional logger.
Definition: journaller.h:169
JournalValueJanitor::operator=
const JournalValueJanitor & operator=(const JournalValueJanitor &)
Journaller::flushLine
void flushLine()
Flush any data currently queued for logging to the file buffer.
Definition: journaller.cpp:292
operator<<
std::ostream & operator<<(std::ostream &os, JlHexLogger< T > const &hex)
Definition: journaller.h:323
Journaller::operator=
Journaller & operator=(Journaller const &)=delete
Journaller::m_useDateTime
bool m_useDateTime
Definition: journaller.h:167
JournalValueJanitor::m_msg
std::string m_msg
Definition: journaller.h:422
Journaller::hasAdditionalLogger
static bool hasAdditionalLogger()
Definition: journaller.h:140
Journaller::debugLevel
JournalLogLevel debugLevel() const
Definition: journaller.h:108
abstractadditionallogger.h
Journaller::writeThread
void writeThread()
Write the current time to the file.
Definition: journaller.cpp:242
Journaller::m_level
JournalLogLevel m_level
Definition: journaller.h:162
Journaller::setTag
void setTag(const std::string &tag)
Set a tag to be added before the log level tag in each log file.
Definition: journaller.cpp:370
Journaller::Journaller
Journaller(const XsString &pathfile, bool purge=true, JournalLogLevel initialLogLevel=JLL_Alert)
Constructor.
Definition: journaller.cpp:121
Journaller::setDebugLevel
void setDebugLevel(JournalLogLevel level, bool writeLogLine=true)
Set the log level for logging to debug output.
Definition: journaller.cpp:355
Journaller::additionalLogger
static AbstractAdditionalLogger * additionalLogger()
Definition: journaller.h:146
Journaller::log
void log(JournalLogLevel level, const std::string &msg)
Write a log message to the file if level is at least equal to the current log level.
Definition: journaller.cpp:201
Journaller::tagFromFilename
static std::string tagFromFilename(const std::string &fn)
Definition: journaller.cpp:151
Journaller::writeCallstack
void writeCallstack(JournalLogLevel level)
Write the current callstack to the file if level is at least equal to the current log level.
Definition: journaller.cpp:327
Journaller::setLogLevel
void setLogLevel(JournalLogLevel level, bool writeLogLine=true)
Set the log level for logging to file.
Definition: journaller.cpp:343
Journaller::setFlushLevel
void setFlushLevel(JournalLogLevel level, bool writeLogLine=true)
Set level threshold for automatically flushing lines to disk.
Definition: journaller.cpp:318
Journaller::writeTag
void writeTag()
Write the tag to the file.
Definition: journaller.cpp:254
JournalValueJanitor::m_level
JournalLogLevel m_level
Definition: journaller.h:423
Journaller::flush
void flush()
Flush any data to disk.
Definition: journaller.cpp:308
Journaller::writeLevel
void writeLevel(JournalLogLevel level)
Write the supplied log level to the file.
Definition: journaller.cpp:265
XsString
A 0-terminated managed string of characters.
Journaller::init
void init(XsString const &pathfile, bool purge)
Initialize the Journaller by (re-)creating the internal journal file.
Definition: journaller.cpp:138
Journaller::filename
const XsString filename() const
Returns the filename of the used journal file.
Definition: journaller.cpp:363
JournalThreader
Manages threaded writes for the Journaller objects.
Definition: journalthreader.h:79
Journaller::tag
std::string tag() const
Definition: journaller.cpp:382
JlHexLogger::JlHexLogger
JlHexLogger(T i)
Constructor.
Definition: journaller.h:316


xsens_mti_driver
Author(s):
autogenerated on Sun Sep 3 2023 02:43:20