Nazara Engine  0.4
A fast, complete, cross-platform API designed for game development
FileLogger.hpp
1 // Copyright (C) 2017 Jérôme Leclercq
2 // This file is part of the "Nazara Engine - Core module"
3 // For conditions of distribution and use, see copyright notice in Config.hpp
4 
5 #pragma once
6 
7 #ifndef NAZARA_FILELOGGER_HPP
8 #define NAZARA_FILELOGGER_HPP
9 
10 #include <Nazara/Prerequesites.hpp>
11 #include <Nazara/Core/AbstractLogger.hpp>
12 #include <Nazara/Core/File.hpp>
13 #include <Nazara/Core/StdLogger.hpp>
14 
15 namespace Nz
16 {
17  class NAZARA_CORE_API FileLogger : public AbstractLogger
18  {
19  public:
20  FileLogger(const String& logPath = "NazaraLog.log");
21  FileLogger(const FileLogger&) = default;
22  FileLogger(FileLogger&&) = default;
23  ~FileLogger();
24 
25  void EnableTimeLogging(bool enable);
26  void EnableStdReplication(bool enable) override;
27 
28  bool IsStdReplicationEnabled() const override;
29  bool IsTimeLoggingEnabled() const;
30 
31  void Write(const String& string) override;
32  void WriteError(ErrorType type, const String& error, unsigned int line = 0, const char* file = nullptr, const char* function = nullptr) override;
33 
34  FileLogger& operator=(const FileLogger&) = default;
35  FileLogger& operator=(FileLogger&&) = default;
36 
37  private:
38  File m_outputFile;
39  StdLogger m_stdLogger;
40  bool m_forceStdOutput;
41  bool m_stdReplicationEnabled;
42  bool m_timeLoggingEnabled;
43  };
44 }
45 
46 #endif // NAZARA_FILELOGGER_HPP
TODO: Inherit SoundEmitter from Node.
Definition: Algorithm.hpp:12
Core class that represents a logger writing to standard output (stdout, stderr)
Definition: StdLogger.hpp:15
Core class that represents a string.
Definition: String.hpp:22
Core class that represents a file.
Definition: File.hpp:29
Core class that represents a file logger.
Definition: FileLogger.hpp:17
Core class that represents the behaviour of the log classes.
Definition: AbstractLogger.hpp:15