-
Notifications
You must be signed in to change notification settings - Fork 0
/
wxMsFileLogh.h
39 lines (33 loc) · 1.17 KB
/
wxMsFileLogh.h
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
/*-----------------------------------------------------------------
* Name: wxMsFileLogh.h
* Purpose: Setup logging to a file
* Adapted from code at:
* from: https://forums.wxwidgets.org/viewtopic.php?f=1&t=42551&p=172671&hilit=settimestamp#p172671
* Author: A. Wiegert
*
* Copyright:
* Licence: wxWidgets licence
*-------------------------------------------------------------- */
#ifndef _WXMS_FILE_LOG_H
#define _WXMS_FILE_LOG_H
#include <wx/log.h>
#include <wx/datetime.h>
#include <wx/ffile.h>
// ------------------------------------------------------------------
class MyFileLog : public wxLog
{
public:
MyFileLog(const wxString& fileName);
~MyFileLog();
virtual void Flush();
bool IsLogFileOK() const { return m_logFile.IsOpened() && !m_logFile.Error(); }
wxString GetLogFileName() const { return m_logFile.GetName(); }
void OpenLog( const wxString& fileName );
void CloseLog();
protected:
virtual void DoLogRecord(wxLogLevel level, const wxString& msg, const wxLogRecordInfo& info);
private:
wxFFile m_logFile;
};
#endif // _WXMS_FILE_LOG_H
// ------------------------------- eof ---------------------------