1
/******************************************************************************
2
* swlog.h - definition of class SWLog used for logging messages
4
* $Id: swlog.h 2080 2007-09-17 06:21:29Z scribe $
6
* Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
7
* CrossWire Bible Society
11
* This program is free software; you can redistribute it and/or modify it
12
* under the terms of the GNU General Public License as published by the
13
* Free Software Foundation version 2.
15
* This program is distributed in the hope that it will be useful, but
16
* WITHOUT ANY WARRANTY; without even the implied warranty of
17
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18
* General Public License for more details.
22
//---------------------------------------------------------------------------
25
//---------------------------------------------------------------------------
31
class SWDLLEXPORT SWLog {
34
static SWLog *systemLog;
38
static const int LOG_ERROR;
39
static const int LOG_WARN;
40
static const int LOG_INFO;
41
static const int LOG_TIMEDINFO;
42
static const int LOG_DEBUG;
44
static SWLog *getSystemLog();
45
static void setSystemLog(SWLog *newLogger);
47
SWLog() { logLevel = 1; /*default to show only errors*/}
50
void setLogLevel(char level) { logLevel = level; }
51
char getLogLevel() const { return logLevel; }
52
void logWarning(const char *fmt, ...) const;
53
void logError(const char *fmt, ...) const;
54
void logInformation(const char *fmt, ...) const;
55
virtual void logTimedInformation(const char *fmt, ...) const;
56
void logDebug(const char *fmt, ...) const;
58
// Override this method if you want to have a custom logger
59
virtual void logMessage(const char *message, int level) const;