HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
UT_UniversalLogConsoleSink.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * NAME: UT_UniversalLogConsoleSink.h
7  *
8  * COMMENTS:
9  *
10  */
11 
12 #ifndef __UT_UNIVERSALLOGCONSOLESINK_H__
13 #define __UT_UNIVERSALLOGCONSOLESINK_H__
14 
15 #include "UT_API.h"
16 #include "UT_Error.h"
17 #include "UT_StringArray.h"
18 #include "UT_StringHolder.h"
20 
22 
24 {
25 public:
26  enum OutFlags
27  {
28  kNONE = 0x0,
29  kFILE = 0x1,
30  kLINE = 0x2,
31  kFILELINE = kFILE | kLINE,
32  kTHREAD = 0x4,
33  kDATE = 0x8
34  };
35 
38  : myEnableColor(false)
39  , myOutputFlags(OutFlags::kNONE)
40  {
41  init();
42  }
44  const UT_StringArray& whitelist,
45  const UT_StringArray& blacklist)
46  : myEnableColor(false)
47  , myOutputFlags(OutFlags::kNONE)
48  {
49  init();
50  }
52  {
53  // We may get doLog calls until we are disconnected, so we must
54  // disconnect before doing any real destruction of this object.
55  disconnectAll();
56  }
57 
58  void setEnableColor(bool enable)
59  { myEnableColor = enable; }
60  bool enableColor() const
61  { return myEnableColor; }
62 
63 protected:
64  void formatLogEntry(const UT_UniversalLogEntry &entry,
65  UT_StringHolder &msg) const override;
67  const UT_StringHolder &msg) const override;
68 
69 private:
70  void init();
71  static void printToConsole(
72  int error_level,
73  const char* msg,
74  bool enable_color);
75 
76  int myOutputFlags;
77  bool myEnableColor;
78 };
79 
80 #endif // __UT_UNIVERSALLOGCONSOLESINK_H__
81 
UT_ErrorSeverity
Definition: UT_Error.h:25
#define UT_API
Definition: UT_API.h:14
UT_UniversalLogConsoleSink(const UT_StringArray &whitelist, const UT_StringArray &blacklist)
virtual void formatLogEntry(const UT_UniversalLogEntry &entry, UT_StringHolder &msg) const =0
GLenum GLenum severity
Definition: glcorearb.h:2539
virtual void writeString(UT_ErrorSeverity severity, const UT_StringHolder &msg) const =0
Simple object to hold the data associated with a single log entry event.