Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(logging): environment variables with per-subsystem details #8833

Merged
merged 2 commits into from
Apr 6, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 42 additions & 15 deletions docs/environment-variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,28 +17,55 @@ 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`
`IPFS_LOGGING` is a deprecated alias for the `GOLOG_LOG_LEVEL` environment variable. See below.

Logging can also be configured (on a subsystem by subsystem basis) at runtime
with the `ipfs log` command.
## `IPFS_LOGGING_FMT`

Default: `ERROR`
Specifies the log message format.

## `IPFS_LOGGING_FMT`
`IPFS_LOGGING_FMT` is a deprecated alias for the `GOLOG_LOG_FMT` environment variable. See below.

## `GOLOG_LOG_LEVEL`

Specifies the log-level, both globally and on a per-subsystem basis. Level can be one of:

* `debug`
lidel marked this conversation as resolved.
Show resolved Hide resolved
* `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
```

Sets the log message format. Can be one of:
Logging can also be configured at runtime, both globally and on a per-subsystem basis, with the `ipfs log` command.

* `color`
* `nocolor`
## `GOLOG_LOG_FMT`

Default: `color`
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`

Expand Down