Phasor
01.00.10.059
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
Phasor
Phasor
Logging.h
Go to the documentation of this file.
1
#pragma once
2
3
#include "../Common/Streams.h"
4
#include <memory>
5
6
// Stream which output data to a file with .log extension and timestamps
7
// each entry.
8
class
CLoggingStream
:
public
COutStream
9
{
10
private
:
11
// Initializes the stream.
12
void
Initialize(
const
std::wstring& directory,
13
const
std::wstring&
fileName
,
const
std::wstring&
moveDirectory
);
14
void
SetNames(
const
std::wstring& directory,
15
const
std::wstring& fileName,
const
std::wstring& moveDirectory);
16
17
// Check if the file should be moved.
18
void
CheckAndMove(
DWORD
curSize);
19
20
protected
:
21
std::wstring
moveDirectory
;
// directory to move file to
22
std::wstring
filePath
;
// path to file inclusive of name and extension
23
std::wstring
fileName
;
// name of file (no path info, no extension)
24
std::wstring
fileDirectory
;
25
DWORD
byteSize
;
// max size for file before being moved
26
DWORD
errorOffset
;
// increases when moving the file fails
27
bool
bTimestamp
;
// should timestamps be prepended? default true
28
29
// COutStream
30
bool
Write
(
const
std::wstring& str)
override
;
31
CLoggingStream
(
const
CLoggingStream
& other);
32
public
:
33
// directory should be normalized (finish with a single \\)
34
CLoggingStream
(
const
std::wstring&
fileDirectory
,
35
const
std::wstring& fileName,
const
std::wstring& moveDirectory);
36
~CLoggingStream
();
37
38
// COutStream
39
std::unique_ptr<COutStream>
clone
()
const override
40
{
41
return
std::unique_ptr<COutStream>(
new
CLoggingStream
(*
this
));
42
}
43
44
virtual
void
SetMoveSize
(
DWORD
kbSize);
45
virtual
void
SetMoveDirectory
(
const
std::wstring& move_to);
46
virtual
void
SetOutFile
(
const
std::wstring& directory,
const
std::wstring& fileName);
47
virtual
void
SetOutFile
(
const
std::wstring& fileName);
// use cur dir
48
virtual
void
EnableTimestamp
(
bool
state);
// true by default
49
virtual
bool
DoTimestamp
() {
return
bTimestamp
; }
50
static
std::wstring
PrependTimestamp
(
const
std::wstring& str);
51
};
52
53
typedef
CLoggingStream
CPhasorLog
;
54
typedef
CLoggingStream
CScriptsLog
;
55
typedef
CLoggingStream
CRconLog
;
Generated on Mon Jul 22 2013 17:09:02 for Phasor by
1.8.2-20121118