HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
UT_UniversalLogFileSink.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_UniversalLogFileSink.h
7  *
8  * COMMENTS:
9  *
10  */
11 
12 #ifndef __UT_UNIVERSALLOGFILESINK_H__
13 #define __UT_UNIVERSALLOGFILESINK_H__
14 
15 #include "UT_API.h"
16 #include "UT_Error.h"
17 #include "UT_StringHolder.h"
19 
21 
23 {
24 public:
27  : myFilePath(filepath)
28  {
29  }
31  {
32  // We may get doLog calls until we are disconnected, so we must
33  // disconnect before doing any real destruction of this object.
34  disconnectAll();
35  }
36 
37  const UT_StringHolder &filePath() const
38  { return myFilePath; }
39 
40  void setMaxFileSize(exint max_size) { myMaxFileSize = max_size; }
41  exint maxFileSize() const { return myMaxFileSize; }
42 
43  void setAppendDate(bool adate) { myAppendDate = adate; }
44  bool appendDate() const { return myAppendDate; }
45 
46  void setPermissions(unsigned int perms) { myPermissions = perms; }
47  unsigned int permissions() const { return myPermissions; }
48 
49 protected:
50  void formatLogEntry(const UT_UniversalLogEntry &entry,
51  UT_StringHolder &msg) const override;
53  const UT_StringHolder &msg) const override;
54 
55 private:
56  UT_StringHolder myFilePath;
57  exint myMaxFileSize = -1;
58  bool myAppendDate = false;
59  unsigned int myPermissions = 0;
60 
61  mutable bool myHasAdjustedPermissions = false;
62 };
63 
64 #endif // __UT_UNIVERSALLOGFILESINK_H__
65 
int64 exint
Definition: SYS_Types.h:125
UT_ErrorSeverity
Definition: UT_Error.h:25
#define UT_API
Definition: UT_API.h:14
unsigned int permissions() const
void setMaxFileSize(exint max_size)
virtual void formatLogEntry(const UT_UniversalLogEntry &entry, UT_StringHolder &msg) const =0
const UT_StringHolder & filePath() const
GLenum GLenum severity
Definition: glcorearb.h:2539
virtual void writeString(UT_ErrorSeverity severity, const UT_StringHolder &msg) const =0
UT_UniversalLogFileSink(const UT_StringHolder &filepath)
void setPermissions(unsigned int perms)
Simple object to hold the data associated with a single log entry event.