Skip to content
Snippets Groups Projects
Commit a602746b authored by Simon McVittie's avatar Simon McVittie
Browse files

log: Read SRT_LOG environment variable

parent 5f326109
No related branches found
No related tags found
1 merge request!517log: Add a flags parameter to _srt_util_set_glib_log_handler
...@@ -262,17 +262,19 @@ Some variables will be set programmatically by ...@@ -262,17 +262,19 @@ Some variables will be set programmatically by
Some variables affect the behaviour of **steam-runtime-launch-client**: Some variables affect the behaviour of **steam-runtime-launch-client**:
`PRESSURE_VESSEL_LOG_INFO` (boolean) `PRESSURE_VESSEL_LOG_INFO` (boolean)
: If set to `1`, increase the log verbosity up to the info level. : If set to 1, same as `SRT_LOG=info`
If set to `0`, no effect.
`PRESSURE_VESSEL_LOG_WITH_TIMESTAMP` (boolean) `PRESSURE_VESSEL_LOG_WITH_TIMESTAMP` (boolean)
: If set to `1`, prepend the log entries with a timestamp. : If set to 1, same as `SRT_LOG=timestamp`
If set to `0`, no effect.
`SHELL` `SHELL`
: If set to a non-empty value, it is used as the default shell when : If set to a non-empty value, it is used as the default shell when
no *COMMAND* is provided. no *COMMAND* is provided.
`SRT_LOG`
: A sequence of tokens separated by colons, spaces or commas
affecting how output is recorded. See source code for details.
`TERM` `TERM`
: If standard input, standard output or standard error is a terminal, : If standard input, standard output or standard error is a terminal,
then this environment variable is passed to the *COMMAND* by default. then this environment variable is passed to the *COMMAND* by default.
......
...@@ -91,6 +91,10 @@ version of the Steam Runtime, the tool should be renamed to ...@@ -91,6 +91,10 @@ version of the Steam Runtime, the tool should be renamed to
Even if its D-Bus well-known name is taken over by another process, Even if its D-Bus well-known name is taken over by another process,
it can still be contacted via its D-Bus unique name. it can still be contacted via its D-Bus unique name.
`SRT_LOG`
: A sequence of tokens separated by colons, spaces or commas
affecting how output is recorded. See source code for details.
# OUTPUT # OUTPUT
Unstructured diagnostic messages are printed on standard error. Unstructured diagnostic messages are printed on standard error.
......
...@@ -179,12 +179,10 @@ manipulate environment variables on a per-command basis. ...@@ -179,12 +179,10 @@ manipulate environment variables on a per-command basis.
## Variables read by steam-runtime-launcher-service ## Variables read by steam-runtime-launcher-service
`PRESSURE_VESSEL_LOG_INFO` (boolean) `PRESSURE_VESSEL_LOG_INFO` (boolean)
: If set to `1`, increase the log verbosity up to the info level. : If set to 1, same as `SRT_LOG=info`
If set to `0`, no effect.
`PRESSURE_VESSEL_LOG_WITH_TIMESTAMP` (boolean) `PRESSURE_VESSEL_LOG_WITH_TIMESTAMP` (boolean)
: If set to `1`, prepend the log entries with a timestamp. : If set to 1, same as `SRT_LOG=timestamp`
If set to `0`, no effect.
`SRT_LAUNCHER_SERVICE_STOP_ON_EXIT` (boolean) `SRT_LAUNCHER_SERVICE_STOP_ON_EXIT` (boolean)
: If set to `0`, the default behaviour changes to be equivalent to : If set to `0`, the default behaviour changes to be equivalent to
...@@ -196,6 +194,10 @@ manipulate environment variables on a per-command basis. ...@@ -196,6 +194,10 @@ manipulate environment variables on a per-command basis.
**--no-stop-on-name-loss**, unless overridden by **--stop-on-name-loss**. **--no-stop-on-name-loss**, unless overridden by **--stop-on-name-loss**.
If set to `1`, no effect. If set to `1`, no effect.
`SRT_LOG`
: A sequence of tokens separated by colons, spaces or commas
affecting how output is recorded. See source code for details.
`STEAM_COMPAT_APP_ID` (integer) `STEAM_COMPAT_APP_ID` (integer)
: Used by **--session** to identify the Steam app ID (game ID). : Used by **--session** to identify the Steam app ID (game ID).
......
...@@ -222,12 +222,14 @@ exit status. ...@@ -222,12 +222,14 @@ exit status.
# ENVIRONMENT # ENVIRONMENT
`PRESSURE_VESSEL_LOG_INFO` (boolean) `PRESSURE_VESSEL_LOG_INFO` (boolean)
: If set to `1`, increase the log verbosity up to the info level. : If set to 1, same as `SRT_LOG=info`
If set to `0`, no effect.
`PRESSURE_VESSEL_LOG_WITH_TIMESTAMP` (boolean) `PRESSURE_VESSEL_LOG_WITH_TIMESTAMP` (boolean)
: If set to `1`, prepend the log entries with a timestamp. : If set to 1, same as `SRT_LOG=timestamp`
If set to `0`, no effect.
`SRT_LOG`
: A sequence of tokens separated by colons, spaces or commas
affecting how output is recorded. See source code for details.
# OUTPUT # OUTPUT
......
...@@ -380,12 +380,10 @@ The following environment variables (among others) are read by ...@@ -380,12 +380,10 @@ The following environment variables (among others) are read by
If set to `0`, equivalent to `--no-import-vulkan-layers`. If set to `0`, equivalent to `--no-import-vulkan-layers`.
`PRESSURE_VESSEL_LOG_INFO` (boolean) `PRESSURE_VESSEL_LOG_INFO` (boolean)
: If set to `1`, increase the log verbosity up to the info level. : If set to 1, same as `SRT_LOG=info`
If set to `0`, no effect.
`PRESSURE_VESSEL_LOG_WITH_TIMESTAMP` (boolean) `PRESSURE_VESSEL_LOG_WITH_TIMESTAMP` (boolean)
: If set to `1`, prepend the log entries with a timestamp. : If set to 1, same as `SRT_LOG=timestamp`
If set to `0`, no effect.
`PRESSURE_VESSEL_REMOVE_GAME_OVERLAY` (boolean) `PRESSURE_VESSEL_REMOVE_GAME_OVERLAY` (boolean)
: If set to `1`, equivalent to `--remove-game-overlay`. : If set to `1`, equivalent to `--remove-game-overlay`.
...@@ -437,6 +435,10 @@ The following environment variables (among others) are read by ...@@ -437,6 +435,10 @@ The following environment variables (among others) are read by
: Used to choose between logically equivalent names for the current : Used to choose between logically equivalent names for the current
working directory (see **get_current_dir_name**(3)). working directory (see **get_current_dir_name**(3)).
`SRT_LOG`
: A sequence of tokens separated by colons, spaces or commas
affecting how output is recorded. See source code for details.
`STEAM_COMPAT_APP_ID` (integer) `STEAM_COMPAT_APP_ID` (integer)
: Equivalent to `--steam-app-id="$STEAM_COMPAT_APP_ID"`. : Equivalent to `--steam-app-id="$STEAM_COMPAT_APP_ID"`.
......
...@@ -326,6 +326,13 @@ log_handler (const gchar *log_domain, ...@@ -326,6 +326,13 @@ log_handler (const gchar *log_domain,
* Flags affecting logging. * Flags affecting logging.
*/ */
static const GDebugKey log_enable[] =
{
{ "debug", SRT_LOG_FLAGS_DEBUG },
{ "info", SRT_LOG_FLAGS_INFO },
{ "timestamp", SRT_LOG_FLAGS_TIMESTAMP },
};
/* /*
* _srt_util_set_glib_log_handler: * _srt_util_set_glib_log_handler:
* @extra_log_domain: (nullable): A log domain, usually %G_LOG_DOMAIN * @extra_log_domain: (nullable): A log domain, usually %G_LOG_DOMAIN
...@@ -341,6 +348,11 @@ log_handler (const gchar *log_domain, ...@@ -341,6 +348,11 @@ log_handler (const gchar *log_domain,
* The chosen message format is used for @extra_log_domain, and also * The chosen message format is used for @extra_log_domain, and also
* for the `steam-runtime-tools` log domain used by the * for the `steam-runtime-tools` log domain used by the
* steam-runtime-tools library. * steam-runtime-tools library.
*
* Logging can be configured by the `SRT_LOG` environment variable,
* which is a sequence of tokens separated by colons, spaces or commas
* matching the nicknames of #SrtLogFlags members. See
* g_parse_debug_string().
*/ */
void void
_srt_util_set_glib_log_handler (const char *extra_log_domain, _srt_util_set_glib_log_handler (const char *extra_log_domain,
...@@ -351,6 +363,9 @@ _srt_util_set_glib_log_handler (const char *extra_log_domain, ...@@ -351,6 +363,9 @@ _srt_util_set_glib_log_handler (const char *extra_log_domain,
| SRT_LOG_LEVEL_FAILURE | SRT_LOG_LEVEL_FAILURE
| G_LOG_LEVEL_WARNING | G_LOG_LEVEL_WARNING
| G_LOG_LEVEL_MESSAGE); | G_LOG_LEVEL_MESSAGE);
const char *log_env = g_getenv ("SRT_LOG");
flags |= g_parse_debug_string (log_env, log_enable, G_N_ELEMENTS (log_enable));
if (_srt_boolean_environment ("PRESSURE_VESSEL_LOG_WITH_TIMESTAMP", FALSE)) if (_srt_boolean_environment ("PRESSURE_VESSEL_LOG_WITH_TIMESTAMP", FALSE))
flags |= SRT_LOG_FLAGS_TIMESTAMP; flags |= SRT_LOG_FLAGS_TIMESTAMP;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment