gwnavruntime/basesystem/defaultlog.h Source File

defaultlog.h
Go to the documentation of this file.
1 /*
2 * Copyright 2016 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 #pragma once
9 
11 
15 
16 
17 namespace Kaim
18 {
19 
20 class File;
21 class VisualDebugServer;
22 
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 DefaultLog& Instance() { static DefaultLog s_instance; return s_instance; }
34 
36  virtual void LogMessageVarg(LogMessageId messageId, const char* fmt, va_list argList);
37 
38  virtual void LogBuffer(LogMessageId messageId, const char* buffer);
39 
40  virtual void ReleaseMemorySystemResources();
41 
44  void SetLogToMode(LogToModeMask logToMode) { m_logToMode = logToMode; }
45 
47  void SetupLogFile(const char* logAbsPath, FileOpenerBase* fileOpener = nullptr);
48 
52  virtual void SetVisualDebugServer(VisualDebugServer* visualDebugServer) { m_visualDebugServer = visualDebugServer; }
53  virtual VisualDebugServer* GetVisualDebugServer() { return m_visualDebugServer; }
54 
55 protected:
56  DefaultLog();
57  virtual ~DefaultLog(); // don't do anything here please. use ReleaseMemorySystemResources to deallocated stuff.
58  void CloseLogFile(); // close m_file, sets m_fileOpener = nullptr
59 
60 protected:
61  UInt32 m_logToMode;
62  FileOpenerBase* m_fileOpener; // if set to nullptr, Kaim::DefaultFileOpener will be used;
63  char m_logFilename[260];
64  Ptr<File> m_file;
65  VisualDebugServer* m_visualDebugServer;
66 };
67 
68 
69 
70 }
71 
void SetLogToMode(LogToModeMask logToMode)
close m_file
Definition: defaultlog.h:44
Base interface for a class that opens a file on disk.
Definition: fileopener.h:30
Default implementation of the BaseLog interface.
Definition: defaultlog.h:26
void SetupLogFile(const char *logAbsPath, FileOpenerBase *fileOpener=nullptr)
.GwNavLog will be appended to logAbsPath
Definition: defaultlog.cpp:107
virtual void LogMessageVarg(LogMessageId messageId, const char *fmt, va_list argList)
calls LogBuffer()
Definition: defaultlog.cpp:47
virtual void SetVisualDebugServer(VisualDebugServer *visualDebugServer)
Beware, when running multiple worlds, the log from all worlds will be sent to this VisualDebugServer ...
Definition: defaultlog.h:52
std::uint32_t UInt32
uint32_t
Definition: SF_Types.h:137
The Autodesk Navigation namespace.
Definition: gamekitcrowddispersion.cpp:17
virtual void ReleaseMemorySystemResources()
This is called in Kaim::BaseSystem::Destroy() before Navigation memory system is destroyed.
Definition: defaultlog.cpp:101
In Navigation, BaseLog MUST be used instead of Kaim::Log.
Definition: baselog.h:18