ToolMap
Loading...
Searching...
No Matches
tmlog.h
1/***************************************************************************
2 tmlog.h
3 Display log message for specified severity (even if chained)
4 -------------------
5 copyright : (C) 2010 CREALP Lucien Schreiber
6 ***************************************************************************/
7
8/***************************************************************************
9 * *
10 * This program is free software; you can redistribute it and/or modify *
11 * it under the terms of the GNU General Public License as published by *
12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. *
14 * *
15 ***************************************************************************/
16
17#ifndef _TM_LOG_H_
18#define _TM_LOG_H_
19
20// For compilers that support precompilation, includes "wx/wx.h".
21#include <wx/wxprec.h>
22
23// Include wxWidgets' headers
24#ifndef WX_PRECOMP
25#include <wx/wx.h>
26#endif
27
28#include <wx/version.h>
29
30class tmLogGuiSeverity : public wxLogGui {
31 private:
32 wxLogLevel m_LogLevel;
33
34 public:
35 tmLogGuiSeverity(wxLogLevel minlevel = wxLOG_Warning) {
36 m_LogLevel = minlevel;
37 }
38
39#if wxCHECK_VERSION(2, 9, 0)
40
41 virtual void DoLogRecord(wxLogLevel level, const wxString& msg, const wxLogRecordInfo& info) {
42 if (level <= m_LogLevel) {
43 wxLogGui::DoLogRecord(level, msg, info);
44 }
45 }
46
47#else
48 // support version 2.8.x
49 virtual void DoLog(wxLogLevel level, const wxChar* msg, time_t timestamp) {
50 if (level <= m_LogLevel) {
51 // display wxLogWarning in a friendly way to the user.
52 wxLogGui::DoLog(level, msg, timestamp);
53 }
54 }
55#endif
56};
57
58#endif
Definition tmlog.h:30