From 9a096d6f85ce202f7f5240da6b10ca919448d78c Mon Sep 17 00:00:00 2001 From: Justin Johnson Date: Wed, 30 Mar 2022 18:00:45 -0500 Subject: [PATCH 1/2] docs: environment-variables.md Document IPFS_LOGGING deprecation as alias to GOLOG_LOG_LEVEL and expand doc to include per-subsystem log levels. --- docs/environment-variables.md | 39 ++++++++++++++++++++++++----------- 1 file changed, 27 insertions(+), 12 deletions(-) diff --git a/docs/environment-variables.md b/docs/environment-variables.md index 174e283f9fc..efcc64d8750 100644 --- a/docs/environment-variables.md +++ b/docs/environment-variables.md @@ -17,19 +17,9 @@ Default: ~/.ipfs ## `IPFS_LOGGING` -Sets the log level for go-ipfs. It can be set to one of: +Specifies the log level for go-ipfs. -* `CRITICAL` -* `ERROR` -* `WARNING` -* `NOTICE` -* `INFO` -* `DEBUG` - -Logging can also be configured (on a subsystem by subsystem basis) at runtime -with the `ipfs log` command. - -Default: `ERROR` +`IPFS_LOGGING` is a deprecated alias for the `GOLOG_LOG_LEVEL` environment variable. See below. ## `IPFS_LOGGING_FMT` @@ -40,6 +30,31 @@ Sets the log message format. Can be one of: Default: `color` +## `GOLOG_LOG_LEVEL` + +Specifies the log-level, both globally and on a per-subsystem basis. Level can be one of: + +* `debug` +* `info` +* `warn` +* `error` +* `dpanic` +* `panic` +* `fatal` + +Per-subsystem levels can be specified with `subsystem=level`. One global level and one or more per-subsystem levels +can be specified by separating them with commas. + +Default: `error` + +Example: + +```console +GOLOG_LOG_LEVEL="error,core/server=debug" ipfs daemon +``` + +Logging can also be configured at runtime, both globally and on a per-subsystem basis, with the `ipfs log` command. + ## `GOLOG_FILE` Sets the file to which go-ipfs logs. By default, go-ipfs logs to standard error. From 80d7d47347f91b19a89155df566fe89285a95362 Mon Sep 17 00:00:00 2001 From: Justin Johnson Date: Wed, 30 Mar 2022 19:53:40 -0500 Subject: [PATCH 2/2] Document IPFS_LOGGING_FMT deprecation as alias to GOLOG_LOG_FMT. --- docs/environment-variables.md | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/docs/environment-variables.md b/docs/environment-variables.md index efcc64d8750..c50d898f899 100644 --- a/docs/environment-variables.md +++ b/docs/environment-variables.md @@ -23,12 +23,9 @@ Specifies the log level for go-ipfs. ## `IPFS_LOGGING_FMT` -Sets the log message format. Can be one of: +Specifies the log message format. -* `color` -* `nocolor` - -Default: `color` +`IPFS_LOGGING_FMT` is a deprecated alias for the `GOLOG_LOG_FMT` environment variable. See below. ## `GOLOG_LOG_LEVEL` @@ -55,6 +52,21 @@ GOLOG_LOG_LEVEL="error,core/server=debug" ipfs daemon Logging can also be configured at runtime, both globally and on a per-subsystem basis, with the `ipfs log` command. +## `GOLOG_LOG_FMT` + +Specifies the log message format. It supports the following values: + +- `color` -- human readable, colorized (ANSI) output +- `nocolor` -- human readable, plain-text output. +- `json` -- structured JSON. + +For example, to log structured JSON (for easier parsing): + +```bash +export GOLOG_LOG_FMT="json" +``` +The logging format defaults to `color` when the output is a terminal, and `nocolor` otherwise. + ## `GOLOG_FILE` Sets the file to which go-ipfs logs. By default, go-ipfs logs to standard error.