opensurgsim
LogMessage.h
1 // This file is a part of the OpenSurgSim project.
2 // Copyright 2013, SimQuest Solutions Inc.
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 
16 #ifndef SURGSIM_FRAMEWORK_LOGMESSAGE_H
17 #define SURGSIM_FRAMEWORK_LOGMESSAGE_H
18 
19 #include "SurgSim/Framework/LogMessageBase.h"
20 
21 namespace SurgSim
22 {
23 namespace Framework
24 {
25 
26 class Logger;
27 
30 
31 
33 class LogMessage : public LogMessageBase
34 {
35 public:
36 
37  explicit LogMessage(Logger* logger, int level) : LogMessageBase(logger, level)
38  {
39  }
40 
41  explicit LogMessage(const std::unique_ptr<Logger>& logger, int level) : LogMessageBase(logger.get(), level)
42  {
43  }
44 
45  explicit LogMessage(const std::shared_ptr<Logger>& logger, int level) : LogMessageBase(logger.get(), level)
46  {
47  }
48 
49  ~LogMessage()
50  {
51  flush();
52  }
53 };
54 
55 
57 
58 }; // namespace Framework
59 }; // namespace SurgSim
60 
61 #endif // SURGSIM_FRAMEWORK_LOGMESSAGE_H
LogMessageBase(Logger *logger, int level)
Construct a LogMessage.
Definition: LogMessageBase.cpp:25
Wraps glewInit() to separate the glew opengl definitions from the osg opengl definitions only imgui n...
Definition: AddRandomSphereBehavior.cpp:36
Specialization, handles flush on destruction.
Definition: LogMessage.h:33
void flush()
write the current message to the logger
Definition: LogMessageBase.h:89
An object that can be used to control logging parameters, such as verbosity and log output destinatio...
Definition: Logger.h:51
LogMessageBase is a base class to be used to customize messages for logging textual information can b...
Definition: LogMessageBase.h:40