OpenZWave Library  1.4.3493
windows/LogImpl.h
Go to the documentation of this file.
1 //-----------------------------------------------------------------------------
2 //
3 // LogImpl.h
4 //
5 // Windows implementation of 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 _LogImpl_H
29 #define _LogImpl_H
30 
31 #include "Defs.h"
32 #include <string>
33 #include "platform/Log.h"
34 #include <windows.h>
35 
36 namespace OpenZWave
37 {
40  class LogImpl : public i_LogImpl
41  {
42  private:
43  friend class Log;
44 
45  LogImpl( string const& _filename, bool const _bAppendLog, bool const _bConsoleOutput, LogLevel const _saveLevel, LogLevel const _queueLevel, LogLevel const _dumpTrigger );
46  ~LogImpl();
47 
48  void Write( LogLevel _level, uint8 const _nodeId, char const* _format, va_list _args );
49  void Queue( char const* _buffer );
50  void QueueDump();
51  void QueueClear();
52  void SetLoggingState( LogLevel _saveLevel, LogLevel _queueLevel, LogLevel _dumpTrigger );
53  void SetLogFileName( const string &_filename );
54 
55  string GetTimeStampString();
56  string GetNodeString( uint8 const _nodeId );
57  string GetThreadId();
58  string GetLogLevelString(LogLevel _level);
59  unsigned int toEscapeCode(LogLevel _level);
60 
61  string m_filename;
62  bool m_bConsoleOutput;
63  bool m_bAppendLog;
64  list<string> m_logQueue;
65  LogLevel m_saveLevel;
66  LogLevel m_queueLevel;
67  LogLevel m_dumpTrigger;
68  };
69 
70 } // namespace OpenZWave
71 
72 #endif //_LogImpl_H
73 
LogLevel
Definition: Log.h:41
Definition: Bitfield.h:34
Windows-specific implementation of the Log class.
Definition: windows/LogImpl.h:40
Definition: Log.h:58
Implements a platform-independent log...written to the console and, optionally, a file...
Definition: Log.h:72
unsigned char uint8
Definition: Defs.h:74