Skip to content

Commit

Permalink
Merge pull request FreeRDP#3405 from hardening/wlog_man
Browse files Browse the repository at this point in the history
Add a dedicated man page for wLog
  • Loading branch information
akallabeth authored Jul 7, 2016
2 parents 89c2527 + 1fdcae9 commit 79a360b
Show file tree
Hide file tree
Showing 9 changed files with 224 additions and 36 deletions.
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ compile_commands.json
docs/api
client/X11/xfreerdp.1
client/X11/xfreerdp.1.xml
client/X11/xfreerdp-channels.1.xml
client/X11/xfreerdp-examples.1.xml

# Mac OS X
.DS_Store
Expand Down
2 changes: 1 addition & 1 deletion client/X11/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
*.xml
xfreerdp-argument.1.xml
generate_argument_docbook
9 changes: 6 additions & 3 deletions client/X11/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -93,16 +93,19 @@ if(WITH_MANPAGES)

add_custom_command(OUTPUT xfreerdp.1
COMMAND generate_argument_docbook
COMMAND ${CMAKE_COMMAND} -E copy
COMMAND ${CMAKE_COMMAND} -E copy
${CMAKE_CURRENT_SOURCE_DIR}/xfreerdp-channels.1.xml ${CMAKE_CURRENT_BINARY_DIR}
COMMAND ${CMAKE_COMMAND} -E copy
COMMAND ${CMAKE_COMMAND} -E copy
${CMAKE_CURRENT_SOURCE_DIR}/xfreerdp-examples.1.xml ${CMAKE_CURRENT_BINARY_DIR}
COMMAND ${XSLTPROC_EXECUTABLE} ${DOCBOOKXSL_DIR}/manpages/docbook.xsl xfreerdp.1.xml
COMMAND ${CMAKE_COMMAND} -E copy
${CMAKE_CURRENT_SOURCE_DIR}/xfreerdp-envvar.1.xml ${CMAKE_CURRENT_BINARY_DIR}
COMMAND ${XSLTPROC_EXECUTABLE} ${DOCBOOKXSL_DIR}/manpages/docbook.xsl xfreerdp.1.xml
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
DEPENDS
${CMAKE_CURRENT_BINARY_DIR}/xfreerdp.1.xml
${CMAKE_CURRENT_SOURCE_DIR}/xfreerdp-examples.1.xml
${CMAKE_CURRENT_SOURCE_DIR}/xfreerdp-channels.1.xml
${CMAKE_CURRENT_SOURCE_DIR}/xfreerdp-envvar.1.xml
generate_argument_docbook)

add_custom_target(xfreerdp.manpage ALL
Expand Down
26 changes: 19 additions & 7 deletions client/X11/generate_argument_docbook.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,13 +146,25 @@ int main(int argc, char *argv[])
const char *format = tr_esc_str(arg->Format);
const char *text = tr_esc_str((LPSTR) arg->Text);
fprintf(fp, "\t\t\t<varlistentry>\n");
if(COMMAND_LINE_VALUE_REQUIRED == arg->Flags)
fprintf(fp, "\t\t\t\t<term><option>/%s</option> <replaceable>%s</replaceable></term>\n", name, format);
else
fprintf(fp, "\t\t\t\t<term><option>/%s</option></term>\n", name);
fprintf(fp, "\t\t\t\t<listitem>\n");
fprintf(fp, "\t\t\t\t\t<para>%s</para>\n", format);
fprintf(fp, "\t\t\t\t</listitem>\n");

fprintf(fp, "\t\t\t\t<term><option>/%s</option>", name);
if ((arg->Flags == COMMAND_LINE_VALUE_REQUIRED) && format)
fprintf(fp, " <replaceable>%s</replaceable>\n", format);
fprintf(fp, "</term>\n");

if (format || text)
{
fprintf(fp, "\t\t\t\t<listitem>\n");
fprintf(fp, "\t\t\t\t\t<para>%s\n", format ? format : "");
if (text)
{
if (format)
fprintf(fp, " - ");
fprintf(fp, "%s", text);
}
fprintf(fp, "</para>\n");
fprintf(fp, "\t\t\t\t</listitem>\n");
}
fprintf(fp, "\t\t\t</varlistentry>\n");
free((void*) name);
free((void*) format);
Expand Down
15 changes: 15 additions & 0 deletions client/X11/xfreerdp-envvar.1.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<refsect1>
<title>Environment variables</title>

<variablelist>
<varlistentry>
<term>wlog environment variable</term>
<listitem>
<para>xfreerdp uses wLog as its log facility, you can refer to the
corresponding man page (wlog(1)) for more informations. Arguments passed
via the <replaceable>/log-level</replaceable> or <replaceable>/log-filters</replaceable>
have precedence over the environment variables.</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
3 changes: 3 additions & 0 deletions client/X11/xfreerdp.1.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY syntax SYSTEM "xfreerdp-argument.1.xml">
<!ENTITY channels SYSTEM "xfreerdp-channels.1.xml">
<!ENTITY envvar SYSTEM "xfreerdp-envvar.1.xml">
<!ENTITY examples SYSTEM "xfreerdp-examples.1.xml">
]
>
Expand Down Expand Up @@ -49,6 +50,8 @@ PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"

&channels;

&envvar;

&examples;

<refsect1>
Expand Down
46 changes: 23 additions & 23 deletions client/common/cmdline.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ static COMMAND_LINE_ARGUMENT_A args[] =
{ "u", COMMAND_LINE_VALUE_REQUIRED, "[<domain>\\]<user> or <user>[@<domain>]", NULL, NULL, -1, NULL, "Username" },
{ "p", COMMAND_LINE_VALUE_REQUIRED, "<password>", NULL, NULL, -1, NULL, "Password" },
{ "d", COMMAND_LINE_VALUE_REQUIRED, "<domain>", NULL, NULL, -1, NULL, "Domain" },
{ "g", COMMAND_LINE_VALUE_OPTIONAL, "<gateway>[:port]", NULL, NULL, -1, NULL, "Gateway Hostname" },
{ "g", COMMAND_LINE_VALUE_REQUIRED, "<gateway>[:port]", NULL, NULL, -1, NULL, "Gateway Hostname" },
{ "gu", COMMAND_LINE_VALUE_REQUIRED, "[<domain>\\]<user> or <user>[@<domain>]", NULL, NULL, -1, NULL, "Gateway username" },
{ "gp", COMMAND_LINE_VALUE_REQUIRED, "<password>", NULL, NULL, -1, NULL, "Gateway password" },
{ "gd", COMMAND_LINE_VALUE_REQUIRED, "<domain>", NULL, NULL, -1, NULL, "Gateway domain" },
Expand All @@ -89,7 +89,7 @@ static COMMAND_LINE_ARGUMENT_A args[] =
{ "app-cmd", COMMAND_LINE_VALUE_REQUIRED, "<parameters>", NULL, NULL, -1, NULL, "Remote application command-line parameters" },
{ "app-file", COMMAND_LINE_VALUE_REQUIRED, "<file name>", NULL, NULL, -1, NULL, "File to open with remote application" },
{ "app-guid", COMMAND_LINE_VALUE_REQUIRED, "<app guid>", NULL, NULL, -1, NULL, "Remote application GUID" },
{ "compression", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueTrue, NULL, -1, "z", "Compression" },
{ "compression", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueTrue, NULL, -1, "z", "Enable compression" },
{ "compression-level", COMMAND_LINE_VALUE_REQUIRED, "<level>", NULL, NULL, -1, NULL, "Compression level (0,1,2)" },
{ "shell", COMMAND_LINE_VALUE_REQUIRED, NULL, NULL, NULL, -1, NULL, "Alternate shell" },
{ "shell-dir", COMMAND_LINE_VALUE_REQUIRED, NULL, NULL, NULL, -1, NULL, "Shell working directory" },
Expand All @@ -112,25 +112,25 @@ static COMMAND_LINE_ARGUMENT_A args[] =
{ "unmap-buttons", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueFalse, NULL, -1, NULL, "Let server see real physical pointer button"},
{ "echo", COMMAND_LINE_VALUE_FLAG, NULL, NULL, NULL, -1, "echo", "Echo channel" },
{ "disp", COMMAND_LINE_VALUE_FLAG, NULL, NULL, NULL, -1, NULL, "Display control" },
{ "fonts", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueFalse, NULL, -1, NULL, "Smooth fonts (ClearType)" },
{ "aero", COMMAND_LINE_VALUE_BOOL, NULL, NULL, BoolValueFalse, -1, NULL, "Desktop composition" },
{ "window-drag", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueFalse, NULL, -1, NULL, "Full window drag" },
{ "menu-anims", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueFalse, NULL, -1, NULL, "Menu animations" },
{ "themes", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueTrue, NULL, -1, NULL, "Themes" },
{ "wallpaper", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueTrue, NULL, -1, NULL, "Wallpaper" },
{ "fonts", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueFalse, NULL, -1, NULL, "Enable smooth fonts (ClearType)" },
{ "aero", COMMAND_LINE_VALUE_BOOL, NULL, NULL, BoolValueFalse, -1, NULL, "Enable desktop composition" },
{ "window-drag", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueFalse, NULL, -1, NULL, "Enable full window drag" },
{ "menu-anims", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueFalse, NULL, -1, NULL, "Enable menu animations" },
{ "themes", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueTrue, NULL, -1, NULL, "Enable themes" },
{ "wallpaper", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueTrue, NULL, -1, NULL, "Enable wallpaper" },
{ "gdi", COMMAND_LINE_VALUE_REQUIRED, "<sw|hw>", NULL, NULL, -1, NULL, "GDI rendering" },
{ "gfx", COMMAND_LINE_VALUE_OPTIONAL, "<RFX|AVC420|AVC444>", NULL, NULL, -1, NULL, "RDP8 graphics pipeline (experimental)" },
{ "gfx-thin-client", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueFalse, NULL, -1, NULL, "RDP8 graphics pipeline thin client mode" },
{ "gfx-small-cache", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueFalse, NULL, -1, NULL, "RDP8 graphics pipeline small cache mode" },
{ "gfx-progressive", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueFalse, NULL, -1, NULL, "RDP8 graphics pipeline progressive codec" },
{ "gfx-h264", COMMAND_LINE_VALUE_OPTIONAL, "<AVC420|AVC444>", NULL, NULL, -1, NULL, "RDP8.1 graphics pipeline H264 codec" },
{ "gfx-thin-client", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueFalse, NULL, -1, NULL, "RDP8 graphics pipeline using thin client mode" },
{ "gfx-small-cache", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueFalse, NULL, -1, NULL, "RDP8 graphics pipeline using small cache mode" },
{ "gfx-progressive", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueFalse, NULL, -1, NULL, "RDP8 graphics pipeline using progressive codec" },
{ "gfx-h264", COMMAND_LINE_VALUE_OPTIONAL, "<AVC420|AVC444>", NULL, NULL, -1, NULL, "RDP8.1 graphics pipeline using H264 codec" },
{ "rfx", COMMAND_LINE_VALUE_FLAG, NULL, NULL, NULL, -1, NULL, "RemoteFX" },
{ "rfx-mode", COMMAND_LINE_VALUE_REQUIRED, "<image|video>", NULL, NULL, -1, NULL, "RemoteFX mode" },
{ "frame-ack", COMMAND_LINE_VALUE_REQUIRED, "<number>", NULL, NULL, -1, NULL, "Frame acknowledgement" },
{ "nsc", COMMAND_LINE_VALUE_FLAG, NULL, NULL, NULL, -1, "nscodec", "NSCodec" },
{ "jpeg", COMMAND_LINE_VALUE_FLAG, NULL, NULL, NULL, -1, NULL, "JPEG codec" },
{ "frame-ack", COMMAND_LINE_VALUE_REQUIRED, "<number>", NULL, NULL, -1, NULL, "Number of frame acknowledgement" },
{ "nsc", COMMAND_LINE_VALUE_FLAG, NULL, NULL, NULL, -1, "nscodec", "Enable NSCodec" },
{ "jpeg", COMMAND_LINE_VALUE_FLAG, NULL, NULL, NULL, -1, NULL, "Enable JPEG codec" },
{ "jpeg-quality", COMMAND_LINE_VALUE_REQUIRED, "<percentage>", NULL, NULL, -1, NULL, "JPEG quality" },
{ "nego", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueTrue, NULL, -1, NULL, "protocol security negotiation" },
{ "nego", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueTrue, NULL, -1, NULL, "Enable protocol security negotiation" },
{ "sec", COMMAND_LINE_VALUE_REQUIRED, "<rdp|tls|nla|ext>", NULL, NULL, -1, NULL, "force specific protocol security" },
{ "sec-rdp", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueTrue, NULL, -1, NULL, "rdp protocol security" },
{ "sec-tls", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueTrue, NULL, -1, NULL, "tls protocol security" },
Expand All @@ -151,12 +151,12 @@ static COMMAND_LINE_ARGUMENT_A args[] =
{ "toggle-fullscreen", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueTrue, NULL, -1, NULL, "Alt+Ctrl+Enter toggles fullscreen" },
{ "mouse-motion", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueTrue, NULL, -1, NULL, "mouse-motion" },
{ "parent-window", COMMAND_LINE_VALUE_REQUIRED, "<window id>", NULL, NULL, -1, NULL, "Parent window id" },
{ "bitmap-cache", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueTrue, NULL, -1, NULL, "bitmap cache" },
{ "offscreen-cache", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueTrue, NULL, -1, NULL, "offscreen bitmap cache" },
{ "glyph-cache", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueTrue, NULL, -1, NULL, "glyph cache" },
{ "bitmap-cache", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueTrue, NULL, -1, NULL, "Enable bitmap cache" },
{ "offscreen-cache", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueTrue, NULL, -1, NULL, "Enable offscreen bitmap cache" },
{ "glyph-cache", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueTrue, NULL, -1, NULL, "Glyph cache" },
{ "codec-cache", COMMAND_LINE_VALUE_REQUIRED, "<rfx|nsc|jpeg>", NULL, NULL, -1, NULL, "bitmap codec cache" },
{ "fast-path", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueTrue, NULL, -1, NULL, "fast-path input/output" },
{ "max-fast-path-size", COMMAND_LINE_VALUE_OPTIONAL, "<size>", NULL, NULL, -1, NULL, "maximum fast-path update size" },
{ "fast-path", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueTrue, NULL, -1, NULL, "Enable fast-path input/output" },
{ "max-fast-path-size", COMMAND_LINE_VALUE_OPTIONAL, "<size>", NULL, NULL, -1, NULL, "specify maximum fast-path update size" },
{ "async-input", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueFalse, NULL, -1, NULL, "asynchronous input" },
{ "async-update", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueFalse, NULL, -1, NULL, "asynchronous update" },
{ "async-transport", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueFalse, NULL, -1, NULL, "asynchronous transport (unstable)" },
Expand All @@ -175,8 +175,8 @@ static COMMAND_LINE_ARGUMENT_A args[] =
{ "encryption-methods", COMMAND_LINE_VALUE_REQUIRED, "<40,56,128,FIPS>", NULL, NULL, -1, NULL, "RDP standard security encryption methods" },
{ "from-stdin", COMMAND_LINE_VALUE_FLAG, NULL, NULL, NULL, -1, NULL, "Read credentials from stdin, do not use defaults." },
{ "buildconfig", COMMAND_LINE_VALUE_FLAG | COMMAND_LINE_PRINT_BUILDCONFIG, NULL, NULL, NULL, -1, NULL, "print the build configuration" },
{ "log-level", COMMAND_LINE_VALUE_REQUIRED, "[OFF|FATAL|ERROR|WARN|INFO|DEBUG|TRACE]", NULL, NULL, -1, NULL, "Set the default log level" },
{ "log-filters", COMMAND_LINE_VALUE_REQUIRED, "<logger tag>:<log level>[, <logger tag>:<log level>][, ...]]", NULL, NULL, -1, NULL, "Set logger filters" },
{ "log-level", COMMAND_LINE_VALUE_REQUIRED, "[OFF|FATAL|ERROR|WARN|INFO|DEBUG|TRACE]", NULL, NULL, -1, NULL, "Set the default log level, see wLog(1) for details" },
{ "log-filters", COMMAND_LINE_VALUE_REQUIRED, "<logger tag>:<log level>[, <logger tag>:<log level>][, ...]]", NULL, NULL, -1, NULL, "Set logger filters, see wLog(1) for details" },
{ "pwidth", COMMAND_LINE_VALUE_REQUIRED, "<physical width (mm)>", NULL, NULL, -1, NULL, "Physical width of display (in millimeters)" },
{ "pheight", COMMAND_LINE_VALUE_REQUIRED, "<physical height (mm)>", NULL, NULL, -1, NULL, "Physical height of display (in millimeters)" },
{ "orientation", COMMAND_LINE_VALUE_REQUIRED, "<orientation>", NULL, NULL, -1, NULL, "Orientation of display in degrees (0, 90, 180, 270)" },
Expand Down
8 changes: 8 additions & 0 deletions winpr/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,14 @@ if(BUILD_TESTING)
add_subdirectory(test)
endif()

if(WITH_MANPAGES)
if(OPENBSD)
install(FILES wlog.1 DESTINATION man/man1)
else()
install(FILES wlog.1 DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/man/man1)
endif()
endif(WITH_MANPAGES)

# Exporting

if(${CMAKE_VERSION} VERSION_GREATER "2.8.10")
Expand Down
149 changes: 149 additions & 0 deletions winpr/wlog.1
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
.\" Written by David Fort (contact@hardening-consulting.com)
.\" Process this file with
.\" groff -man -Tascii foo.1
.\"
.TH wLog 13 "June 2016" Version "1.0"
.SH NAME
wLog \- WinPR logging facility

.SH DESCRIPTION
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.

.SH 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 below
described variable WLOG_APPENDER can be used to choose one appender.

The following kind of appenders are available:

.IP Binary
Write the log data into a binary format file.

.IP 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.

.IP File
The file appender writes the textual output to a file.

.IP Udp
This appender sends the logging messages to a pre-defined remote host via UDP.

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 can be used:
nc -u 127.0.0.1 -p 20000 -l
.IP Syslog
Use syslog for outputting the debug messages.
.IP Journald
This appender outputs messages to journald.

.SH Levels
The WLog are complementary, the higher level always includes the lower ones.
The level list below is top down. Top the highest level.

.IP TRACE
print everything including packets dumps
.IP DEBUG
debug messages
.IP INFO
general informations
.IP WARN
warnings
.IP ERROR
errors
.IP FATAL
fatal problems
.IP OFF
completely disable the wlog output

.SH Formats
The format a logger prints has the following possible options:

.IP lv
log level
.IP mn
module name
.IP fl
file name
.IP fn
function
.IP ln
line number
.IP pid
process id
.IP tid
thread id
.IP yr
year
.IP mo
month
.IP dw
day of week
.IP hr
hour
.IP mi
minute
.IP se
second
.IP ml
millisecond
.PP
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


.SH ENVIRONMENT
.IP WLOG_APPENDER
The kind of appender, the accepted values are: CONSOLE, FILE, BINARY, SYSLOG, JOURNALD or UDP

.IP WLOG_PREFIX
configure the prefix used for outputting the message (see Format for more details and examples)

.IP WLOG_LEVEL
the level to output messages for

.IP WLOG_FILTER
sets a filter for WLog messages. Only the filtered messages are
printed. The format of the filter is a serie of \<logger name\>:\<level\> separated by
comas

example: WLOG_FILTER=core.channel:DEBUG,dummy:TRACE
will display debug messages for the core.channel logger and trace level for the dummy logger

.IP WLOG_FILEAPPENDER_OUTPUT_FILE_PATH
When using the file appender it may contains the output log file's path

.IP WLOG_FILEAPPENDER_OUTPUT_FILE_NAME
When using the file appender it may contains the output log file's name

.IP WLOG_JOURNALD_ID
When using the systemd journal appender, this variable contains the id used with
the journal (by default the executable's name)

.IP WLOG_UDP_TARGET
target to use for the UDP appender in the format
.B host:port

.SH BUGS
Please report any bugs using the bug reporting form on the
.B FreeRDP
web site

.SH "SEE ALSO"
Additional information and the latest version is available
at the web site:
.B http://www.freerdp.com

.SH AUTHOR
David Fort <contact@hardening-consulting.com> wrote this manpage from materials written
by Bernhard Miklautz <bernhard.miklautz@thincast.com>.

0 comments on commit 79a360b

Please sign in to comment.