TrueReality  v0.1.1912
LogWriter.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 
31 #include <trUtil/DateTime.h>
32 #include <trUtil/Logging/Log.h>
33 
34 #include <osg/Referenced>
35 
41 namespace trUtil::Logging
42 {
51  class TR_UTIL_EXPORT LogWriter : public osg::Referenced
52  {
53  public:
54 
60  struct LogData
61  {
68  : logLevel(trUtil::Logging::LogLevel::LOG_DEBUG)
69  , frameNumber()
70  , line(){};
71 
72  trUtil::Logging::LogLevel logLevel;
74  unsigned frameNumber;
75  std::string logName;
76  std::string file;
77  std::string method;
78  int line;
79  std::string msg;
80  };
81 
89  virtual void LogMessage(const LogData& logData) = 0;
90 
91  protected:
92 
98  virtual ~LogWriter() {}
99 
100  };
101 }
virtual ~LogWriter()
Destructor.
Definition: LogWriter.h:98
std::string logName
The frame number.
Definition: LogWriter.h:75
LOG_DEBUG
Definition: LogLevel.h:64
std::string file
The name of the Log instance (could be empty)
Definition: LogWriter.h:76
int line
The calling method of the message.
Definition: LogWriter.h:78
LogData()
Default constructor.
Definition: LogWriter.h:67
Interface class to receive messages from the Log.
Definition: LogWriter.h:51
std::string method
The source file of the message.
Definition: LogWriter.h:77
A class that represents date time utility.
Namespace that holds various utility classes for the engine.
Definition: SmrtPtr.h:208
unsigned frameNumber
Time of message.
Definition: LogWriter.h:74
std::string msg
The line number of the source code of the message.
Definition: LogWriter.h:79
trUtil::DateTime time
Log level.
Definition: LogWriter.h:73
trUtil::Logging::LogLevel logLevel
Definition: LogWriter.h:70