VR-Forces 4.8 Class Documentation
 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) 2017 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 /******************************************************************************
6 ** $RCSfile: DtDebugLog.h,v $ $Revision: 1.21 $ $State: Exp $
7 ******************************************************************************/
8 
12 
13 #pragma once
14 #include <vrvUtil/vrvUtil.h>
15 #include <vlutil/vlPrint.h>
16 #include <vlutil/vlExceptions.h>
17 #include <ostream>
18 
19 namespace makVrv
20 {
21  #define DT_LOG_WARN log().out(DtDebugLog::Warning) << "Warning: " << __FUNCTION__ << ": "
22  #define DT_LOG_INFO log().out(DtDebugLog::Information) << "Info: " << __FUNCTION__ << ": "
23  #define DT_LOG_DEBUG log().out(DtDebugLog::Debug) << "Debug: " << __FUNCTION__ << ": "
24  #define DT_LOG_OUT log().out()
25  #define DT_LOG_LEVEL(a) log().levelWillPrint(a)
26 
41  {
42  public:
43 
45  {
46  Warning = 1,
47  Information = 2,
48  Debug = 4,
49  PrintLevel_End = 5
50  };
51 
53  DtDebugLog(const std::string& filename);
54 
56  virtual ~DtDebugLog();
57 
61  {
62  return level() >= alevel;
63  }
64 
66  virtual void setLevel(DtDebugLog::PrintLevel alevel);
67 
69  virtual void setOutputStream(DtOutputStream* stream);
70 
72  virtual DtDebugLog::PrintLevel level();
73 
76  {
77  if(levelWillPrint(level))
78  return *myOutput;
79  else
80  return *myEmptyOutput;
81  }
82 
84  DtOutputStream* outputStream();
85 
86  protected:
90 
92  DtFilePrinter* myFilePrinter;
93 
95  DtOutputStreamBuffer* myBuffer;
96 
98  DtOutputStreamBuffer* myEmptyBuffer;
99 
105 
109  DtOutputStream* myOutput;
110 
114  std::ostream* myEmptyOutput;
115  };
116 }
#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:60
std::ostream & out(DtDebugLog::PrintLevel level=DtDebugLog::Information)
Get the log output.
Definition: DtDebugLog.h:75
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.
Definition: DtDebugLog.h:40
PrintLevel
Definition: DtDebugLog.h:44
Contains DLL export macros.
DtFilePrinter * myFilePrinter
The file printer to log to.
Definition: DtDebugLog.h:92
DtOutputStream * myOutput
The output stream that does all the work.
Definition: DtDebugLog.h:109
Definition: DtDebugLog.h:47
DtOutputStreamBuffer * myBuffer
The buffer used by the output stream.
Definition: DtDebugLog.h:95
std::ostream * myEmptyOutput
The &#39;black hole&#39; output stream When the stream is created, its threshold is set to myPrintLevelThresh...
Definition: DtDebugLog.h:114
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 nev...
Definition: DtDebugLog.h:89
DtOutputStreamBuffer * myEmptyBuffer
The buffer used by the empty output stream.
Definition: DtDebugLog.h:98
int myPrintLevelThresholdRef
The dummy &#39;global notify level&#39; that our DtOutputStream&#39;s will compare their configured thresholds to...
Definition: DtDebugLog.h:104

Document ID: Generated on Thu Aug 27 10:56:05 EDT 2020 from SVN revision 217100
Copyright © 2005-2020 MAK Technologies. All Rights Reserved (www.mak.com)