root/honeyclient/branches/rel/1.0/Capture2/capture-client-xeno-mod/Logger.h

Revision 825, 2.0 kB (checked in by xkovah, 1 year ago)

it works ok, but there is still the 256 character cap on the binary output…I will deal with that later

Line 
1 /*
2  *  PROJECT: Capture
3  *  FILE: Logger.h
4  *  AUTHORS: Ramon Steenson (rsteenson@gmail.com) & Christian Seifert (christian.seifert@gmail.com)
5  *
6  *  Developed by Victoria University of Wellington and the New Zealand Honeynet Alliance
7  *
8  *  This file is part of Capture.
9  *
10  *  Capture is free software; you can redistribute it and/or modify
11  *  it under the terms of the GNU General Public License as published by
12  *  the Free Software Foundation; either version 2 of the License, or
13  *  (at your option) any later version.
14  *
15  *  Capture is distributed in the hope that it will be useful,
16  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
17  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  *  GNU General Public License for more details.
19  *
20  *  You should have received a copy of the GNU General Public License
21  *  along with Capture; if not, write to the Free Software
22  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
23  */
24 #pragma once
25 #include "CaptureGlobal.h"
26 #include <string>
27 #include <queue>
28 #include <list>
29 /*
30     Class: Logger
31
32     A singleton which is accessible to all objects. Allows any object to write data
33     to the log file if required. The "-l file" option must be specified for data
34     to be logged
35 */
36 class Logger
37 {
38 public:
39     ~Logger(void);
40     static Logger* getInstance();
41
42     void openLogFile(wstring file);
43
44     void writeToLog(wstring* message);
45     void writeSystemEventToLog(wstring* type, wstring* time, wstring* process, wstring* action, wstring* object, vector<wstring>* extra);
46
47     void closeLogFile();
48
49     bool isFileOpen() { return fileOpen; }
50
51     wstring getLogFileName() { return logFileName; }
52     wstring getLogFullPath() { return logFullPath; }
53
54 private:
55     static bool instanceCreated;
56     static Logger *logger;
57     Logger(void);
58
59     char* convertToMultiByteString(wstring* message, size_t* charsConverted);
60
61     bool fileOpen;
62     wstring logFullPath;
63     wstring logFileName;
64     HANDLE hLog;
65 };
Note: See TracBrowser for help on using the browser.