gwnavruntime/basesystem/defaultlog.h Source File

defaultlog.h
Go to the documentation of this file.
1 /*
2 * Copyright 2015 Autodesk, Inc. All rights reserved.
3 * Use of this software is subject to the terms of the Autodesk license agreement and any attachments or Appendices thereto provided at the time of installation or download,
4 * or which otherwise accompanies this software in either electronic or hard copy form, or which is signed by you and accepted by Autodesk.
5 */
6 
7 
8 // primary contact: JAPA - secondary contact: BRGR
9 
10 #ifndef Navigation_DefaultLog_H
11 #define Navigation_DefaultLog_H
12 
18 
19 
20 namespace Kaim
21 {
22 
23 class VisualDebugServer;
24 
26 class DefaultLog : public BaseLog
27 {
28 public:
29  typedef UInt32 LogToModeMask;
30  enum LogToMode { LogToNothing = 0, LogToStdout = 1, LogToIde = 2, LogToFile = 4, LogToVisualDebug = 8, LogToAll = 15 };
31 
32 public:
33  static bool IsInitialized;
34  static DefaultLog& Instance() { static DefaultLog s_instance; IsInitialized = true; return s_instance; }
35  static void Destroy();
36 
37  virtual void LogMessageVarg(LogMessageId messageId, const char* fmt, va_list argList);
38  virtual void ReleaseMemorySystemResources();
39 
42  void SetLogToMode(LogToModeMask logToMode) { m_logToMode = logToMode; }
43 
45  void SetupLogFile(const char* absoluteLogFileName, FileOpenerBase* fileOpener = KY_NULL);
46 
49  virtual void SetVisualDebugServer(VisualDebugServer* visualDebugServer) { m_visualDebugServer = visualDebugServer; }
50  virtual VisualDebugServer* GetVisualDebugServer() { return m_visualDebugServer; }
51 
52  virtual void LogBuffer(LogMessageId messageId, const char* buffer);
53 
54 protected:
55  DefaultLog()
56  : m_logToMode(LogToNothing)
57  , m_fileOpener(KY_NULL)
58  , m_file(KY_NULL)
59  , m_visualDebugServer(KY_NULL)
60  {
61  SFstrcpy(m_logFilename, Kaim::ArraySize(m_logFilename), "NavigationLog.GwNavLog");
62  }
63 
64  virtual ~DefaultLog() {} // don't do anything here please
65 
66 private:
67  void DoDestroy();
68 
69 protected:
70  UInt32 m_logToMode;
71  FileOpenerBase* m_fileOpener; // if set to KY_NULL, Kaim::DefaultFileOpener will be used;
72  char m_logFilename[260];
73  Ptr<File> m_file;
74  VisualDebugServer* m_visualDebugServer;
75 };
76 
77 
78 
79 }
80 
81 #endif // Navigation_DefaultLog_H
void SetLogToMode(LogToModeMask logToMode)
Sets the output locations in which debug messages will be printed.
Definition: defaultlog.h:44
Base interface for a class that opens a file on disk.
Definition: fileopener.h:35
Default implementation of the Kaim::Log interface.
Definition: defaultlog.h:26
void SetupLogFile(const char *absoluteLogFileName, FileOpenerBase *fileOpener=0)
.GwNavLog will be appended to absoluteLogFileName
#define KY_NULL
Null value.
Definition: types.h:247
virtual void SetVisualDebugServer(VisualDebugServer *visualDebugServer)
Beware, all logs will be sent through this VisualDebugServer.
Definition: defaultlog.h:52
virtual void ReleaseMemorySystemResources()
This is called in Kaim::BaseSystem::Destroy() before Navigation memory system is destroyed.
Definition: gamekitcrowddispersion.h:20
The VisualDebugServer manages the sending of data to clients.
Definition: visualdebugserver.h:254
KyUInt32 ArraySize(T(&)[N])
Returns the size of a fixed-size array.
Definition: types.h:361
BaseLog must used instead of Kaim::Log due to parti pris for Navigation's VisualDebug.
Definition: baselog.h:19