Leviathan  0.8.0.0
Leviathan game engine
Logger.h
Go to the documentation of this file.
1 #pragma once
2 // ------------------------------------ //
3 #include "Include.h"
4 #include "ErrorReporter.h"
5 
6 namespace Leviathan{
7 
10 class Logger : public LErrorReporter{
11 public:
12 
13  DLLEXPORT Logger(const std::string &file);
14  DLLEXPORT virtual ~Logger();
15 
16  // Logging functions
17  DLLEXPORT void Write(const std::string &data) override;
18  DLLEXPORT void Info(const std::string &data) override;
19  DLLEXPORT void Error(const std::string &data) override;
20  DLLEXPORT void Warning(const std::string &data) override;
21  DLLEXPORT void WriteLine(const std::string &Text) override;
22  DLLEXPORT void Fatal(const std::string &Text) override;
23 
27  DLLEXPORT void WriteRaw(const std::string &data);
28 
29 
30  DLLEXPORT static void SendDebugMessage(const std::string &str);
31 
33  DLLEXPORT static void Print(const std::string &message);
34 
35  DLLEXPORT void Save();
36 
39  DLLEXPORT void DirectWriteBuffer(const std::string &data);
40 
42  DLLEXPORT std::string GetLogFile() const;
43 
44 
45  DLLEXPORT static Logger* Get();
46 
47 private:
48 
50  void _Save();
51 
53  void _LogUpdateEndPart();
54 
55 private:
56 
57  std::string PendingLog;
58  std::string Path;
59 
60  static Logger* LatestLogger;
61 };
62 }
63 
64 #ifdef LEAK_INTO_GLOBAL
65 using Leviathan::Logger;
66 #endif
67 
DLLEXPORT void Fatal(const std::string &Text) override
Quits the current game with an error message.
Definition: Logger.cpp:142
DLLEXPORT void Write(const std::string &data) override
Definition: Logger.cpp:113
DLLEXPORT std::string GetLogFile() const
Gets the file the log is being written to.
Definition: Logger.cpp:244
DLLEXPORT void Info(const std::string &data) override
Definition: Logger.cpp:164
virtual DLLEXPORT ~Logger()
Definition: Logger.cpp:93
DLLEXPORT void WriteLine(const std::string &Text) override
Definition: Logger.cpp:137
static DLLEXPORT void SendDebugMessage(const std::string &str)
Definition: Logger.cpp:227
Logger class for all text output.
Definition: Logger.h:10
DLLEXPORT void Save()
Definition: Logger.cpp:203
DLLEXPORT void Warning(const std::string &data) override
Definition: Logger.cpp:190
DLLEXPORT void DirectWriteBuffer(const std::string &data)
Adds raw data to the queue unmodified.
Definition: Logger.cpp:237
DLLEXPORT Logger(const std::string &file)
Definition: Logger.cpp:33
DLLEXPORT void WriteRaw(const std::string &data)
Prints output without extra newlines (make sure to add them manually)
Definition: Logger.cpp:126
static DLLEXPORT Logger * Get()
Definition: Logger.cpp:106
#define DLLEXPORT
Definition: Include.h:84
static DLLEXPORT void Print(const std::string &message)
Script wrapper.
Definition: Logger.cpp:223
The access mask controls which registered functions and classes a script sees.
Definition: GameModule.h:12
DLLEXPORT void Error(const std::string &data) override
Definition: Logger.cpp:177