FreeRDP
libwinpr/utils/wlog/wlog.h
1 
20 #ifndef WINPR_WLOG_PRIVATE_H
21 #define WINPR_WLOG_PRIVATE_H
22 
23 #include <winpr/wlog.h>
24 
25 #define WLOG_MAX_PREFIX_SIZE 512
26 #define WLOG_MAX_STRING_SIZE 8192
27 
28 typedef BOOL (*WLOG_APPENDER_OPEN_FN)(wLog* log, wLogAppender* appender);
29 typedef BOOL (*WLOG_APPENDER_CLOSE_FN)(wLog* log, wLogAppender* appender);
30 typedef BOOL (*WLOG_APPENDER_WRITE_MESSAGE_FN)(wLog* log, wLogAppender* appender,
31  wLogMessage* message);
32 typedef BOOL (*WLOG_APPENDER_WRITE_DATA_MESSAGE_FN)(wLog* log, wLogAppender* appender,
33  wLogMessage* message);
34 typedef BOOL (*WLOG_APPENDER_WRITE_IMAGE_MESSAGE_FN)(wLog* log, wLogAppender* appender,
35  wLogMessage* message);
36 typedef BOOL (*WLOG_APPENDER_WRITE_PACKET_MESSAGE_FN)(wLog* log, wLogAppender* appender,
37  wLogMessage* message);
38 typedef BOOL (*WLOG_APPENDER_SET)(wLogAppender* appender, const char* setting, void* value);
39 typedef void (*WLOG_APPENDER_FREE)(wLogAppender* appender);
40 
41 #define WLOG_APPENDER_COMMON() \
42  DWORD Type; \
43  BOOL active; \
44  wLogLayout* Layout; \
45  CRITICAL_SECTION lock; \
46  BOOL recursive; \
47  void* TextMessageContext; \
48  void* DataMessageContext; \
49  void* ImageMessageContext; \
50  void* PacketMessageContext; \
51  WLOG_APPENDER_OPEN_FN Open; \
52  WLOG_APPENDER_CLOSE_FN Close; \
53  WLOG_APPENDER_WRITE_MESSAGE_FN WriteMessage; \
54  WLOG_APPENDER_WRITE_DATA_MESSAGE_FN WriteDataMessage; \
55  WLOG_APPENDER_WRITE_IMAGE_MESSAGE_FN WriteImageMessage; \
56  WLOG_APPENDER_WRITE_PACKET_MESSAGE_FN WritePacketMessage; \
57  WLOG_APPENDER_FREE Free; \
58  WLOG_APPENDER_SET Set
59 
61 {
62  WLOG_APPENDER_COMMON();
63 };
64 
65 struct s_wLog
66 {
67  LPSTR Name;
68  LONG FilterLevel;
69  DWORD Level;
70 
71  BOOL IsRoot;
72  BOOL inherit;
73  LPSTR* Names;
74  size_t NameCount;
75  wLogAppender* Appender;
76 
77  wLog* Parent;
78  wLog** Children;
79  DWORD ChildrenCount;
80  DWORD ChildrenSize;
81  CRITICAL_SECTION lock;
82  const char* (*custom)(void*);
83  void* context;
84 };
85 
86 extern const char* WLOG_LEVELS[7];
87 BOOL WLog_Layout_GetMessagePrefix(wLog* log, wLogLayout* layout, wLogMessage* message);
88 
89 #include "Layout.h"
90 #include "Appender.h"
91 
92 #endif /* WINPR_WLOG_PRIVATE_H */