OpenZWave Library
1.4.0
Toggle main menu visibility
Loading...
Searching...
No Matches
cpp
src
platform
Log.h
Go to the documentation of this file.
1
//-----------------------------------------------------------------------------
2
//
3
// Log.h
4
//
5
// Cross-platform message and error logging
6
//
7
// Copyright (c) 2010 Mal Lansell <mal@lansell.org>
8
// All rights reserved.
9
//
10
// SOFTWARE NOTICE AND LICENSE
11
//
12
// This file is part of OpenZWave.
13
//
14
// OpenZWave is free software: you can redistribute it and/or modify
15
// it under the terms of the GNU Lesser General Public License as published
16
// by the Free Software Foundation, either version 3 of the License,
17
// or (at your option) any later version.
18
//
19
// OpenZWave is distributed in the hope that it will be useful,
20
// but WITHOUT ANY WARRANTY; without even the implied warranty of
21
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22
// GNU Lesser General Public License for more details.
23
//
24
// You should have received a copy of the GNU Lesser General Public License
25
// along with OpenZWave. If not, see <http://www.gnu.org/licenses/>.
26
//
27
//-----------------------------------------------------------------------------
28
#ifndef _Log_H
29
#define _Log_H
30
31
#include <stdarg.h>
32
#include <string>
33
#include "
Defs.h
"
34
35
36
37
namespace
OpenZWave
38
{
39
class
Mutex
;
40
extern
char
const
*
LogLevelString
[];
41
enum
LogLevel
42
{
43
LogLevel_Invalid
,
44
LogLevel_None
,
45
LogLevel_Always
,
46
LogLevel_Fatal
,
47
LogLevel_Error
,
48
LogLevel_Warning
,
49
LogLevel_Alert
,
50
LogLevel_Info
,
51
LogLevel_Detail
,
52
LogLevel_Debug
,
54
LogLevel_StreamDetail
,
55
LogLevel_Internal
56
};
57
58
class
i_LogImpl
59
{
60
public
:
61
i_LogImpl
() { } ;
62
virtual
~i_LogImpl
() { } ;
63
virtual
void
Write
(
LogLevel
_level,
uint8
const
_nodeId,
char
const
* _format, va_list _args ) = 0;
64
virtual
void
QueueDump
() = 0;
65
virtual
void
QueueClear
() = 0;
66
virtual
void
SetLoggingState
(
LogLevel
_saveLevel,
LogLevel
_queueLevel,
LogLevel
_dumpTrigger ) = 0;
67
virtual
void
SetLogFileName
(
const
string
&_filename ) = 0;
68
};
69
72
class
Log
73
{
74
public
:
82
static
Log*
Create
(
string
const
& _filename,
bool
const
_bAppend,
bool
const
_bConsoleOutput,
LogLevel
const
_saveLevel,
LogLevel
const
_queueLevel,
LogLevel
const
_dumpTrigger );
83
92
93
static
Log*
Create
(
i_LogImpl
*LogClass );
94
101
static
void
Destroy
();
102
108
static
bool
SetLoggingClass
(
i_LogImpl
*LogClass );
109
114
static
void
SetLoggingState
(
bool
_dologging);
115
123
static
void
SetLoggingState
(
LogLevel
_saveLevel,
LogLevel
_queueLevel,
LogLevel
_dumpTrigger );
124
129
static
bool
GetLoggingState
();
130
137
static
void
GetLoggingState
(
LogLevel
* _saveLevel,
LogLevel
* _queueLevel,
LogLevel
* _dumpTrigger );
138
145
static
void
SetLogFileName
(
const
string
&_filename );
146
155
static
void
Write
(
LogLevel
_level,
char
const
* _format, ... );
156
166
static
void
Write
(
LogLevel
_level,
uint8
const
_nodeId,
char
const
* _format, ... );
167
171
static
void
QueueDump
();
172
176
static
void
QueueClear
();
177
178
private
:
179
Log(
string
const
& _filename,
bool
const
_bAppend,
bool
const
_bConsoleOutput,
LogLevel
_saveLevel,
LogLevel
_queueLevel,
LogLevel
_dumpTrigger );
180
~Log();
181
182
static
i_LogImpl
* m_pImpl;
183
static
Log* s_instance;
184
static
bool
s_customLogger;
185
Mutex
* m_logMutex;
186
};
187
}
// namespace OpenZWave
188
189
#endif
//_Log_H
Defs.h
uint8
unsigned char uint8
Definition
Defs.h:74
OpenZWave::Log::QueueClear
static void QueueClear()
Definition
Log.cpp:286
OpenZWave::Log::GetLoggingState
static bool GetLoggingState()
Determine whether logging is enabled or not (retained for backward compatibility).
Definition
Log.cpp:212
OpenZWave::Log::Write
static void Write(LogLevel _level, char const *_format,...)
Definition
Log.cpp:223
OpenZWave::Log::QueueDump
static void QueueDump()
Definition
Log.cpp:270
OpenZWave::Log::Destroy
static void Destroy()
Definition
Log.cpp:122
OpenZWave::Log::SetLoggingClass
static bool SetLoggingClass(i_LogImpl *LogClass)
Set the Logging Implementation Class to replace the standard File/Console logging.
Definition
Log.cpp:134
OpenZWave::Log::Create
static Log * Create(i_LogImpl *LogClass)
OpenZWave::Log::SetLoggingState
static void SetLoggingState(bool _dologging)
Enable or disable library logging (retained for backward compatibility).
Definition
Log.cpp:156
OpenZWave::Log::GetLoggingState
static void GetLoggingState(LogLevel *_saveLevel, LogLevel *_queueLevel, LogLevel *_dumpTrigger)
Obtain the various logging levels.
OpenZWave::Log::SetLogFileName
static void SetLogFileName(const string &_filename)
Change the log file name. This will start a new log file (or potentially start appending information ...
Definition
Log.cpp:302
OpenZWave::Log::Create
static Log * Create(string const &_filename, bool const _bAppend, bool const _bConsoleOutput, LogLevel const _saveLevel, LogLevel const _queueLevel, LogLevel const _dumpTrigger)
Definition
Log.cpp:74
OpenZWave::Mutex
Implements a platform-independent mutex–for serializing access to a shared resource.
Definition
Mutex.h:40
OpenZWave::i_LogImpl
Definition
Log.h:59
OpenZWave::i_LogImpl::QueueDump
virtual void QueueDump()=0
OpenZWave::i_LogImpl::i_LogImpl
i_LogImpl()
Definition
Log.h:61
OpenZWave::i_LogImpl::SetLogFileName
virtual void SetLogFileName(const string &_filename)=0
OpenZWave::i_LogImpl::~i_LogImpl
virtual ~i_LogImpl()
Definition
Log.h:62
OpenZWave::i_LogImpl::Write
virtual void Write(LogLevel _level, uint8 const _nodeId, char const *_format, va_list _args)=0
OpenZWave::i_LogImpl::QueueClear
virtual void QueueClear()=0
OpenZWave::i_LogImpl::SetLoggingState
virtual void SetLoggingState(LogLevel _saveLevel, LogLevel _queueLevel, LogLevel _dumpTrigger)=0
OpenZWave
Definition
Bitfield.h:35
OpenZWave::LogLevelString
char const * LogLevelString[]
Definition
Log.cpp:45
OpenZWave::LogLevel
LogLevel
Definition
Log.h:42
OpenZWave::LogLevel_Fatal
@ LogLevel_Fatal
Definition
Log.h:46
OpenZWave::LogLevel_Warning
@ LogLevel_Warning
Definition
Log.h:48
OpenZWave::LogLevel_None
@ LogLevel_None
Definition
Log.h:44
OpenZWave::LogLevel_Alert
@ LogLevel_Alert
Definition
Log.h:49
OpenZWave::LogLevel_StreamDetail
@ LogLevel_StreamDetail
Definition
Log.h:54
OpenZWave::LogLevel_Error
@ LogLevel_Error
Definition
Log.h:47
OpenZWave::LogLevel_Info
@ LogLevel_Info
Definition
Log.h:50
OpenZWave::LogLevel_Internal
@ LogLevel_Internal
Definition
Log.h:55
OpenZWave::LogLevel_Always
@ LogLevel_Always
Definition
Log.h:45
OpenZWave::LogLevel_Debug
@ LogLevel_Debug
Definition
Log.h:52
OpenZWave::LogLevel_Invalid
@ LogLevel_Invalid
Definition
Log.h:43
OpenZWave::LogLevel_Detail
@ LogLevel_Detail
Definition
Log.h:51
Generated on
for OpenZWave Library by
1.18.0