diff --git a/doc/hosting/environment-variables.md b/doc/hosting/environment-variables.md index 4dda844..11e942f 100644 --- a/doc/hosting/environment-variables.md +++ b/doc/hosting/environment-variables.md @@ -235,3 +235,45 @@ This setting is useful for developers working on PixivFE itself or for troublesh **Default**: `/tmp/pixivfe/responses` Defines where responses from the Pixiv API are saved when in development mode. + +## Logging Configuration + +PixivFE uses [uber-go/zap](https://github.com/uber-go/zap) for structured, leveled logging. The following environment variables control the logging behavior. + +### `PIXIVFE_LOG_LEVEL` + +**Required**: No + +**Default:** `info` + +Sets the minimum level of log messages to output. Valid options are: + +- `debug`: Includes all log messages, including detailed debug information. +- `info`: Includes informational messages, warnings, and errors. +- `warn`: Includes only warning and error messages. +- `error`: Includes only error messages. + +### `PIXIVFE_LOG_OUTPUTS` + +**Required**: No + +**Default:** `["stdout"]` + +Specifies where log messages should be sent. This can be a single output or multiple outputs separated by commas. Valid options include: + +- `stdout`: Standard output (console) +- `stderr`: Standard error +- File paths: e.g., `/var/log/pixivfe.log` + +Example: `PIXIVFE_LOG_OUTPUTS=stdout,/var/log/pixivfe.log` + +### `PIXIVFE_LOG_FORMAT` + +**Required**: No + +**Default:** `console` + +Determines the format of log messages. Valid options are: + +- `console`: Human-readable format suitable for console output +- `json`: Structured JSON format, useful for log parsing and analysis tools