1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
|
# Overview
WLog is a configurable and flexible logging system used throughout winpr and
FreeRDP.
The primary concept is to have a hierarchy of loggers that can be be configured
independently.
TODO add more details and configuration examples.
# Environment variables
* WLOG_APPENDER - the appender to use possible values below also see the Appender section.
* CONSOLE
* FILE
* BINARY
* SYSLOG
* JOURNALD
* UDP
* WLOG_PREFIX - configure the prefix used for outputting the message (see
Format for more details and examples)
* WLOG_LEVEL - the level to output messages for
* WLOG_FILTER - sets a filter for WLog messages. Only the filtered messages are
printed
* WLOG_FILEAPPENDER_OUTPUT_FILE_PATH - set the output file path for the file
file appender
* WLOG_FILEAPPENDER_OUTPUT_FILE_NAME - set the output file name for the output
appender
* WLOG_JOURNALD_ID - identifier used by the journal appender
* WLOG_UDP_TARGET - target to use for the UDP appender in the format host:port
# Levels
The WLog are complementary the higher level always includes the lower ones.
The level list below is top down. Top the highest level.
* WLOG_TRACE - print everything including package dumps
* WLOG_DEBUG - debug messages
* WLOG_INFO - general informations
* WLOG_WARN - warnings
* WLOG_ERROR - errors
* WLOG_FATAL - fatal problems
* WLOG_OFF - completely disable the wlog output
# Format
The format a logger prints in has the following possible options:
* "lv" - log level
* "mn" - module name
* "fl" - file name
* "fn" - function
* "ln" - line number
* "pid" - process id
* "tid" - thread id
* "yr" - year
* "mo" - month
* "dw" - day of week
* "hr" - hour
* "mi" - minute
* "se" - second
* "ml" - millisecond
A maximum of 16 options can be used per format string.
An example that generally sets the WLOG_PREFIX for xfreerdp would look like:
```
WLOG_PREFIX="pid=%pid:tid=%tid:fn=%fn -" xfreerdp /v:xxx
```
# Appenders
WLog uses different appenders that define where the log output should be written
to. If the application doesn't explicitly configure the appenders the above
described variable WLOG_APPENDER can be used to choose one appender.
The following represents an overview about all appenders and their possible
configuration values.
### Binary
Write the log data into a binary format file.
Options:
* "outputfilename", value const char* - file to write the data to
* "outputfilepath", value const char* - location of the output file
### Callback
The callback appender can be used from an application to get all log messages
back the application. For example if an application wants to handle the log
output itself.
Options:
* "callbacks", value struct wLogCallbacks*, callbacks to use
### Console
The console appender writes to the console. Depending of the operating system
the application runs on the output might be handled differently. For example
on android log print would be used.
Options:
* "outputstream", value const char * - output stream to write to
* "stdout" - write everything to stdout
* "stderr" - write everything to stderr
* "default" - use the default settings - in this case errors and fatal would
go to stderr everything else to stdout
* debug - use the debug output. Only used on windows on all operating systems
this behaves as as if default was set.
### File
The file appender writes the textual output to a file.
Options:
* "outputfilename", value const char*, filename to use
* "outputfilepath", value const char*, location of the file
### Udp
This appender sends the logging messages to a pre-defined remote host via UDP.
Options:
* "target", value const char*, target to send the data too in the format
host:port
If no target is set the default one 127.0.0.1:20000 is used. To receive the
log messages one can use netcat. To receive the default target the following
command could be used.
```
nc -u 127.0.0.1 -p 20000 -l
```
### Syslog (optional)
Use syslog for outputting the debug messages. No options available.
### Journald (optional)
For outputting the log messages to journald this appender can be used.
The available options are:
* "identifier", value const char*, the identifier to use for journald (default
is winpr)
|