TrueReality  v0.1.1912
LogWriterFile.h
Go to the documentation of this file.
1 /*
2 * True Reality Open Source Game and Simulation Engine
3 * Copyright © 2021 Acid Rain Studios LLC
4 *
5 * The Base of this class has been adopted from the Delta3D engine
6 *
7 * This library is free software; you can redistribute it and/or modify it under
8 * the terms of the GNU Lesser General Public License as published by the Free
9 * Software Foundation; either version 3.0 of the License, or (at your option)
10 * any later version.
11 *
12 * This library is distributed in the hope that it will be useful, but WITHOUT
13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
14 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
15 * details.
16 *
17 * You should have received a copy of the GNU Lesser General Public License
18 * along with this library; if not, write to the Free Software Foundation, Inc.,
19 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 *
21 * Class Inspired by the Delta3D Engine
22 * http://delta3dengine.org/
23 *
24 * @author Erik Johnson
25 * @author Maxim Serebrennik
26 */
27 #pragma once
28 
29 #include <trUtil/Export.h>
30 
32 
33 #include <fstream>
34 #include <string>
35 
41 namespace trUtil::Logging
42 {
49  {
50  public:
51 
56  const static std::string DEFAULT_LOG_FOLDER;
57 
63  LogWriterFile();
64 
70  void OpenFile();
71 
79  virtual void LogMessage(const LogData& logData);
80 
86  void LogHorizRule();
87 
95  bool IsOpenFailed();
96 
102  void ResetOpenFail();
103 
104  protected:
105 
111  virtual ~LogWriterFile();
112 
113  private:
114  std::ofstream mLogFile;
116  void TimeTag(std::string prefix);
117  void EndFile();
118  };
119 }
A specialized LogWriter class that outputs Log messages to a file.
Definition: LogWriterFile.h:48
Interface class to receive messages from the Log.
Definition: LogWriter.h:51
A class that represents date time utility.
static const std::string DEFAULT_LOG_FOLDER
The folder path that is appended to the User Data folder (PathUtil::GetUserTCDataFolder()) ...
Definition: LogWriterFile.h:56