docs: document logging config

This commit is contained in:
perennial
2024-10-14 15:01:51 +11:00
parent e57116abb1
commit e36e0698ec
+42
View File
@@ -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