VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtDebugLog.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2024 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
9 
10 #pragma once
11 #include <vrvUtil/vrvUtil.h>
12 #include <vlutil/vlPrint.h>
13 #include <vlutil/vlExceptions.h>
14 #include <ostream>
15 
16 namespace makVrv
17 {
18  #define DT_LOG_FATAL log().out(DtDebugLog::Fatal) << "Fatal: " << __FUNCTION__ << ": "
19  #define DT_LOG_WARN log().out(DtDebugLog::Warning) << "Warning: " << __FUNCTION__ << ": "
20  #define DT_LOG_INFO log().out(DtDebugLog::Information) << "Info: " << __FUNCTION__ << ": "
21  #define DT_LOG_DEBUG log().out(DtDebugLog::Debug) << "Debug: " << __FUNCTION__ << ": "
22  #define DT_LOG_OUT log().out()
23  #define DT_LOG_LEVEL(a) log().levelWillPrint(a)
24 
39  {
40  public:
41 
43  {
44  Fatal = 0,
45  Warning = 1,
46  Information = 2,
47  Debug = 4,
48  PrintLevel_End = 5
49  };
50 
52  DtDebugLog(const std::string& filename);
53 
55  virtual ~DtDebugLog();
56 
60  {
61  return level() >= alevel;
62  }
63 
65  virtual void setLevel(DtDebugLog::PrintLevel alevel);
66 
68  virtual void setOutputStream(DtOutputStream* stream);
69 
71  virtual DtDebugLog::PrintLevel level();
72 
75  {
76  if(levelWillPrint(level))
77  return *myOutput;
78  else
79  return *myEmptyOutput;
80  }
81 
83  DtOutputStream* outputStream();
84 
85  protected:
89 
91  DtFilePrinter* myFilePrinter;
92 
94  DtOutputStreamBuffer* myBuffer;
95 
97  DtOutputStreamBuffer* myEmptyBuffer;
98 
104 
108  DtOutputStream* myOutput;
109 
113  std::ostream* myEmptyOutput;
114  };
115 }
#define DT_DLL_VRVUTIL
Definition: vrvUtil.h:34
bool levelWillPrint(DtDebugLog::PrintLevel alevel)
Check to see if the provided level would print with the current level.
Definition: DtDebugLog.h:59
std::ostream & out(DtDebugLog::PrintLevel level=DtDebugLog::Information)
Get the log output.
Definition: DtDebugLog.h:74
DT_DLL_VRVCORE DtTaitBryan level(const DtCoordinateSystem &cs, const DtVector &localOrigin, double topoHeading)
Returns a level orientation with the topographic heading.
This is a simple class for logging information to a file. To be used, the caller must specify a loggi...
Definition: DtDebugLog.h:38
PrintLevel
Definition: DtDebugLog.h:42
Contains DLL export macros.
DtFilePrinter * myFilePrinter
The file printer to log to.
Definition: DtDebugLog.h:91
DtOutputStream * myOutput
The output stream that does all the work. When the stream is created, its threshold is set to myPrint...
Definition: DtDebugLog.h:108
Definition: DtDebugLog.h:46
DtOutputStreamBuffer * myBuffer
The buffer used by the output stream.
Definition: DtDebugLog.h:94
std::ostream * myEmptyOutput
The &#39;black hole&#39; output stream When the stream is created, its threshold is set to myPrintLevelThresh...
Definition: DtDebugLog.h:113
voidpf stream
Definition: ioapi.h:39
PrintLevel myLevel
variable used to decide whether send output to the &#39;works always&#39; stream (myOutput) or the &#39;works ne...
Definition: DtDebugLog.h:88
DtOutputStreamBuffer * myEmptyBuffer
The buffer used by the empty output stream.
Definition: DtDebugLog.h:97
int myPrintLevelThresholdRef
The dummy &#39;global notify level&#39; that our DtOutputStream&#39;s will compare their configured thresholds to...
Definition: DtDebugLog.h:103

Document ID: Generated on Tue Sep 24 19:28:17 EDT 2024 from SVN revision 269799
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)