File: sysLogger.h

package info (click to toggle)
pgadmin3 1.20.0~beta2-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 73,704 kB
  • ctags: 18,591
  • sloc: cpp: 193,786; ansic: 18,736; sh: 5,154; pascal: 1,120; yacc: 927; makefile: 516; lex: 421; xml: 126; perl: 40
file content (77 lines) | stat: -rw-r--r-- 1,800 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
//////////////////////////////////////////////////////////////////////////
//
// pgAdmin III - PostgreSQL Tools
//
// Copyright (C) 2002 - 2014, The pgAdmin Development Team
// This software is released under the PostgreSQL Licence
//
// sysLogger.h - Log handling class
//
//////////////////////////////////////////////////////////////////////////

#ifndef SYSLOGGER_H
#define SYSLOGGER_H

// wxWindows headers
#include <wx/wx.h>

// App headers

enum LOG_LEVEL
{
    LOG_NONE = 0,
    LOG_ERRORS = 1,
    LOG_NOTICE = 2,
    LOG_SQL = 3,
    LOG_DEBUG = 4
};

// Class declarations
class sysLogger : public wxLog
{
public:
#if wxCHECK_VERSION(2, 9, 0)
	void DoLogTextAtLevel(wxLogLevel level, const wxString &msg);
#else
	virtual void DoLog(wxLogLevel level, const wxChar *msg, time_t timestamp);
#endif

	static wxLogLevel logLevel;
	static wxString logFile;

private:
	void WriteLog(const wxString &msg);
	bool SilenceMessage(const wxString &msg);
};

#define wxLOG_Notice (wxLOG_User+1)
#define wxLOG_Sql (wxLOG_User+2)
#define wxLOG_QuietError (wxLOG_User+3)
#define wxLOG_Script (wxLOG_User+4)
#define wxLOG_ScriptVerbose (wxLOG_User+5)

#if wxCHECK_VERSION(2, 9, 0)

#define wxLogNotice wxDO_LOG(Notice)
#define wxLogSql wxDO_LOG(Sql)
#define wxLogQuietError wxDO_LOG(QuietError)
#define wxLogScript wxDO_LOG(Script)
#define wxLogScriptVerbose wxDO_LOG(ScriptVerbose)

#else

#define DECLARE_INT_LOG_FUNCTION(level)                                  \
extern void wxVLog##level(const wxChar *szFormat, va_list argptr);       \
extern void wxLog##level(const wxChar *szFormat, ...)

DECLARE_INT_LOG_FUNCTION(Notice);
DECLARE_INT_LOG_FUNCTION(Sql);
DECLARE_INT_LOG_FUNCTION(QuietError);
DECLARE_INT_LOG_FUNCTION(Script);
DECLARE_INT_LOG_FUNCTION(ScriptVerbose);

#endif


#endif // SYSLOGGER_H