GteLogReporter.cpp
Go to the documentation of this file.
1 // David Eberly, Geometric Tools, Redmond WA 98052
2 // Copyright (c) 1998-2017
3 // Distributed under the Boost Software License, Version 1.0.
4 // http://www.boost.org/LICENSE_1_0.txt
5 // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt
6 // File Version: 3.0.0 (2016/06/19)
7 
8 #include <GTEnginePCH.h>
10 using namespace gte;
11 
13 {
14  if (mLogToStdout)
15  {
17  }
18 
19  if (mLogToFile)
20  {
22  }
23 
24 #if defined(__MSWINDOWS__)
25  if (mLogToOutputWindow)
26  {
27  Logger::Unsubscribe(mLogToOutputWindow.get());
28  }
29 
30  if (mLogToMessageBox)
31  {
32  Logger::Unsubscribe(mLogToMessageBox.get());
33  }
34 #endif
35 }
36 
37 LogReporter::LogReporter(std::string const& logFile, int logFileFlags,
38  int logStdoutFlags, int logMessageBoxFlags, int logOutputWindowFlags)
39  :
40  mLogToFile(nullptr),
41  mLogToStdout(nullptr)
42 #if defined(__MSWINDOWS__)
43  ,
44  mLogToMessageBox(nullptr),
45  mLogToOutputWindow(nullptr)
46 #endif
47 {
48  if (logFileFlags != Logger::Listener::LISTEN_FOR_NOTHING)
49  {
50  mLogToFile = std::make_unique<LogToFile>(logFile, logFileFlags);
52  }
53 
54  if (logStdoutFlags != Logger::Listener::LISTEN_FOR_NOTHING)
55  {
56  mLogToStdout = std::make_unique<LogToStdout>(logStdoutFlags);
58  }
59 
60 #if defined(__MSWINDOWS__)
61  if (logMessageBoxFlags != Logger::Listener::LISTEN_FOR_NOTHING)
62  {
63  mLogToMessageBox = std::make_unique<LogToMessageBox>(logMessageBoxFlags);
64  Logger::Subscribe(mLogToMessageBox.get());
65  }
66 
67  if (logOutputWindowFlags != Logger::Listener::LISTEN_FOR_NOTHING)
68  {
69  mLogToOutputWindow = std::make_unique<LogToOutputWindow>(logOutputWindowFlags);
70  Logger::Subscribe(mLogToOutputWindow.get());
71  }
72 #endif
73 }
LogReporter(std::string const &logFile, int logFileFlags, int logStdoutFlags, int logMessageBoxFlags=0, int logOutputWindowFlags=0)
std::unique_ptr< LogToStdout > mLogToStdout
std::unique_ptr< LogToFile > mLogToFile
GLsizei const GLchar *const * string
Definition: glcorearb.h:809
static void Subscribe(Listener *listener)
Definition: GteLogger.cpp:75
static void Unsubscribe(Listener *listener)
Definition: GteLogger.cpp:82


geometric_tools_engine
Author(s): Yijiang Huang
autogenerated on Thu Jul 18 2019 04:00:00