Phasor  01.00.10.059
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GameLogging.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "ThreadedLogging.h"
4 
5 // These are encoded as 8 bit numbers
6 // xxxx xxxx
7 // type event
8 // Where type is Game, Player etc and event is the specific event (join, leave etc)
9 
11 {
12  kGameEnd = 1 << 4,
14  kPlayerJoin = (1 << 5) + 2,
19  kServerCommand = (1 << 6) + 6,
21  kScriptEvent = (1 << 7) + 8
22 };
23 
24 class CGameLog
25 {
26 private:
27  std::unique_ptr<CThreadedLogging> logstream;
28  static const unsigned int kSaveDelay = 10000; // 10 seconds
29 
30 public:
31  CGameLog(const std::wstring& dir, const std::wstring& file,
32  PhasorThread& thread);
33 
34  // linebreak is automatically added
35  void WriteLog(glog_type type, wchar_t* format, ...);
36  void WriteLog(glog_type type, char* format, ...);
37 
38  CLoggingStream& GetLogStream() { return *logstream; }
39 };