Blame docs/wlog.md

Packit Service fa4841
# Overview
Packit Service fa4841
Packit Service fa4841
WLog is a configurable and flexible logging system used throughout winpr and
Packit Service fa4841
FreeRDP.
Packit Service fa4841
Packit Service fa4841
The primary concept is to have a hierarchy of loggers that can be be configured
Packit Service fa4841
independently.
Packit Service fa4841
Packit Service fa4841
TODO add more details and configuration examples.
Packit Service fa4841
Packit Service fa4841
Packit Service fa4841
Packit Service fa4841
# Environment variables
Packit Service fa4841
Packit Service fa4841
* WLOG_APPENDER  - the appender to use possible values below also see the Appender section.
Packit Service fa4841
  * CONSOLE
Packit Service fa4841
  * FILE
Packit Service fa4841
  * BINARY
Packit Service fa4841
  * SYSLOG
Packit Service fa4841
  * JOURNALD
Packit Service fa4841
  * UDP
Packit Service fa4841
* WLOG_PREFIX - configure the prefix used for outputting the message (see
Packit Service fa4841
  Format for more details and examples)
Packit Service fa4841
* WLOG_LEVEL - the level to output messages for
Packit Service fa4841
* WLOG_FILTER - sets a filter for WLog messages. Only the filtered messages are
Packit Service fa4841
printed
Packit Service fa4841
* WLOG_FILEAPPENDER_OUTPUT_FILE_PATH  - set the output file path for the file
Packit Service fa4841
file appender
Packit Service fa4841
* WLOG_FILEAPPENDER_OUTPUT_FILE_NAME - set the output file name for the output
Packit Service fa4841
appender
Packit Service fa4841
* WLOG_JOURNALD_ID - identifier used by the journal appender
Packit Service fa4841
* WLOG_UDP_TARGET - target to use for the UDP appender in the format host:port
Packit Service fa4841
Packit Service fa4841
# Levels
Packit Service fa4841
Packit Service fa4841
The WLog are complementary the higher level always includes the lower ones.
Packit Service fa4841
The level list below is top down. Top the highest level.
Packit Service fa4841
Packit Service fa4841
* WLOG_TRACE - print everything including package dumps
Packit Service fa4841
* WLOG_DEBUG - debug messages
Packit Service fa4841
* WLOG_INFO - general informations
Packit Service fa4841
* WLOG_WARN - warnings
Packit Service fa4841
* WLOG_ERROR - errors
Packit Service fa4841
* WLOG_FATAL - fatal problems
Packit Service fa4841
* WLOG_OFF - completely disable the wlog output
Packit Service fa4841
Packit Service fa4841
Packit Service fa4841
# Format
Packit Service fa4841
Packit Service fa4841
The format a logger prints in has the following possible options:
Packit Service fa4841
Packit Service fa4841
* "lv" - log level
Packit Service fa4841
* "mn" - module name
Packit Service fa4841
* "fl" - file name
Packit Service fa4841
* "fn" - function
Packit Service fa4841
* "ln" - line number
Packit Service fa4841
* "pid" - process id
Packit Service fa4841
* "tid" - thread id
Packit Service fa4841
* "yr" - year
Packit Service fa4841
* "mo" - month
Packit Service fa4841
* "dw" - day of week
Packit Service fa4841
* "hr" - hour
Packit Service fa4841
* "mi" - minute
Packit Service fa4841
* "se" - second
Packit Service fa4841
* "ml" - millisecond
Packit Service fa4841
Packit Service fa4841
A maximum of 16 options can be used per format string.
Packit Service fa4841
Packit Service fa4841
An example that generally sets the WLOG_PREFIX for xfreerdp would look like:
Packit Service fa4841
```
Packit Service fa4841
WLOG_PREFIX="pid=%pid:tid=%tid:fn=%fn -" xfreerdp /v:xxx
Packit Service fa4841
```
Packit Service fa4841
Packit Service fa4841
# Appenders
Packit Service fa4841
Packit Service fa4841
WLog uses different appenders that define where the log output should be written
Packit Service fa4841
to. If the application doesn't explicitly configure the appenders the above
Packit Service fa4841
described variable WLOG_APPENDER can be used to choose one appender.
Packit Service fa4841
Packit Service fa4841
The following represents an overview about all appenders and their possible
Packit Service fa4841
configuration values.
Packit Service fa4841
Packit Service fa4841
### Binary
Packit Service fa4841
Packit Service fa4841
Write the log data into a binary format file.
Packit Service fa4841
Packit Service fa4841
Options:
Packit Service fa4841
* "outputfilename", value const char* - file to write the data to
Packit Service fa4841
* "outputfilepath", value const char* - location of the output file
Packit Service fa4841
Packit Service fa4841
### Callback
Packit Service fa4841
The callback appender can be used from an application to get all log messages
Packit Service fa4841
back the application. For example if an application wants to handle the log
Packit Service fa4841
output itself.
Packit Service fa4841
Packit Service fa4841
Options:
Packit Service fa4841
Packit Service fa4841
* "callbacks", value struct wLogCallbacks*, callbacks to use
Packit Service fa4841
Packit Service fa4841
### Console
Packit Service fa4841
Packit Service fa4841
The console appender writes to the console. Depending of the operating system
Packit Service fa4841
the application runs on the output might be handled differently. For example
Packit Service fa4841
on android log print would be used.
Packit Service fa4841
Packit Service fa4841
Options:
Packit Service fa4841
Packit Service fa4841
Packit Service fa4841
* "outputstream", value const char * - output stream to write to
Packit Service fa4841
  * "stdout" - write everything to stdout
Packit Service fa4841
  * "stderr" - write everything to stderr
Packit Service fa4841
  * "default" - use the default settings - in this case errors and fatal would
Packit Service fa4841
  go to stderr everything else to stdout
Packit Service fa4841
  * debug - use the debug output. Only used on windows on all operating systems
Packit Service fa4841
  this behaves as as if default was set.
Packit Service fa4841
Packit Service fa4841
### File
Packit Service fa4841
The file appender writes the textual output to a file.
Packit Service fa4841
Packit Service fa4841
Options:
Packit Service fa4841
Packit Service fa4841
* "outputfilename", value const char*, filename to use
Packit Service fa4841
* "outputfilepath", value const char*, location of the file
Packit Service fa4841
Packit Service fa4841
### Udp
Packit Service fa4841
Packit Service fa4841
This appender sends the logging messages to a pre-defined remote host via UDP.
Packit Service fa4841
Packit Service fa4841
Options:
Packit Service fa4841
Packit Service fa4841
* "target", value const char*, target to send the data too in the format
Packit Service fa4841
host:port
Packit Service fa4841
Packit Service fa4841
If no target is set the default one 127.0.0.1:20000 is used. To receive the
Packit Service fa4841
log messages one can use netcat. To receive the default target the following
Packit Service fa4841
command could be used.
Packit Service fa4841
```
Packit Service fa4841
nc -u 127.0.0.1 -p 20000 -l
Packit Service fa4841
```
Packit Service fa4841
Packit Service fa4841
### Syslog (optional)
Packit Service fa4841
Packit Service fa4841
Use syslog for outputting the debug messages. No options available.
Packit Service fa4841
Packit Service fa4841
### Journald (optional)
Packit Service fa4841
Packit Service fa4841
For outputting the log messages to journald this appender can be used.
Packit Service fa4841
The available options are:
Packit Service fa4841
Packit Service fa4841
* "identifier", value const char*, the identifier to use for journald (default
Packit Service fa4841
  is winpr)