Skip to content

tests: Add sample code to print GLib messages with a priority prefix

Simon McVittie requested to merge wip/smcv/task444-sample into main

Something similar to this could be used inside steamwebhelper and other Steam executables that are linked to GLib, if desired.

Followup for steamrt/tasks#444.

Typical output:

<3>priority-logwriter [main] internal error: this is a mockup of a critical warning
<4>priority-logwriter [main] warning: this is a mockup of an ordinary warning
<5>priority-logwriter [main] this is a mockup of a somewhat important message
<5>priority-logwriter [main] this message
<5>contains
<5>multiple
<5>lines
<6>priority-logwriter [main] this is a mockup of an informational message
<7>priority-logwriter [main] this is a mockup of a debug message
<3>priority-logwriter [MyLib] (old log API) internal error: this is a mockup of a critical warning from a library
<4>priority-logwriter [MyLib] (old log API) warning: this is a mockup of an ordinary warning from a library
<5>priority-logwriter [MyLib] (old log API) this is a mockup of a somewhat important message from a library
<5>priority-logwriter [MyLib] (old log API) this message
<5>contains
<5>multiple
<5>lines
<6>priority-logwriter [MyLib] (old log API) this is a mockup of an informational message from a library
<7>priority-logwriter [MyLib] (old log API) this is a mockup of a debug message from a library
<5>priority-logwriter [MyLib] Structured message: Invalid cross-device link [errno 18]

/cc @refi64 @denittis

Merge request reports

Loading