TrueReality  v0.1.1912
LogFile.cpp
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 * @author Matthew W. Campbell
22 * @author Erik Johnson
23 * @author David Guthrie
24 * @author Maxim Serebrennik
25 */
26 
27 #include <trUtil/Logging/LogFile.h>
28 
29 #include <trUtil/PlatformMacros.h>
30 #include <trUtil/Logging/Log.h>
32 
33 namespace trUtil::Logging
34 {
35 #ifdef _DEBUG
36  std::string LogFile::mTitle("True Reality SDK Log File (<font color=#A000A0>DEBUG LIBs)</font>");
37 #else
38  std::string LogFile::mTitle("True Reality SDK Log File");
39 #endif
40 
41  const std::string LogFile::LOG_FILE_DEFAULT_NAME("TrueRealityLog.html");
42  std::string LogFile::mLogFileName = LOG_FILE_DEFAULT_NAME;
43 
45  void LogFile::SetFileName(const std::string& name)
46  {
47  bool sameName = name == mLogFileName;
48 
49  mLogFileName = name;
50  if (!sameName)
51  {
52  //Reset open failed if the file name changes.
54  }
55  }
56 
58  const std::string LogFile::GetFileName()
59  {
60  return mLogFileName;
61  }
62 
64  void LogFile::SetTitle(const std::string& title)
65  {
66  mTitle = title;
67  }
68 
70  const std::string& LogFile::GetTitle()
71  {
72  return mTitle;
73  }
74 }
LogManager & GetLogManagerRef()
Returns a reference to the internal Log Manager.
Definition: Log.cpp:221
static void SetFileName(const std::string &name)
Change the name of the log file (defaults to "TrueRealityLog.html")
Definition: LogFile.cpp:45
static std::string mLogFileName
Definition: LogFile.h:91
static const std::string GetFileName()
Get the current filename of the log file.
Definition: LogFile.cpp:58
static const std::string LOG_FILE_DEFAULT_NAME
Log file default name.
Definition: LogFile.h:53
static void SetTitle(const std::string &title)
Change the title string used in HTML.
Definition: LogFile.cpp:64
static const std::string & GetTitle()
Get the current HTML title string.
Definition: LogFile.cpp:70
static std::string mTitle
Definition: LogFile.h:92
void ReOpenFile()
Reopens the log file.
Definition: LogManager.cpp:94
static Log & GetInstance(const std::string &name=Log::LOG_DEFAULT_NAME)
Retrieve singleton instance of the log class for a give string name.
Definition: Log.cpp:203