docs: separate configuration and logging documentation
Extracts logging documentation into its own file (docs/logging.md) and updates README.md to link to both configuration and logging guides.
This commit is contained in:
@@ -41,11 +41,10 @@ make test
|
||||
make lint
|
||||
```
|
||||
|
||||
## Configuration
|
||||
## Documentation
|
||||
|
||||
The application is configured via a YAML file (default `config/config.yaml`) and environment variables.
|
||||
|
||||
For detailed documentation on configuration options and logging, see [docs/configuration.md](docs/configuration.md).
|
||||
- [Configuration Guide](docs/configuration.md): Details on YAML config, environment variables, and CLI flags.
|
||||
- [Logging Guide](docs/logging.md): Information about log levels and structured logging format.
|
||||
|
||||
## Docker
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
# Configuration and Logging
|
||||
# Configuration
|
||||
|
||||
This application uses a flexible configuration system that supports YAML files and environment variable overrides. It also features a structured logging setup.
|
||||
This application uses a flexible configuration system that supports YAML files and environment variable overrides.
|
||||
|
||||
## Configuration
|
||||
## Configuration File
|
||||
|
||||
The configuration is loaded from a YAML file. By default, the application looks for `config/config.yaml`. You can specify a different configuration file using the `-config` CLI flag.
|
||||
|
||||
@@ -10,7 +10,7 @@ The configuration is loaded from a YAML file. By default, the application looks
|
||||
./app -config /path/to/my-config.yaml
|
||||
```
|
||||
|
||||
### Configuration Structure
|
||||
### Structure
|
||||
|
||||
The configuration file supports the following structure:
|
||||
|
||||
@@ -26,7 +26,7 @@ server:
|
||||
port: 8080
|
||||
```
|
||||
|
||||
### Environment Variables
|
||||
## Environment Variables
|
||||
|
||||
All configuration values can be overridden using environment variables. The application uses the `APP_` prefix for all environment variables. The variable name is constructed by capitalizing the path to the configuration value and replacing dots/nesting with underscores.
|
||||
|
||||
@@ -42,29 +42,4 @@ To start the application with `debug` logging and listening on port `9090`:
|
||||
|
||||
```bash
|
||||
APP_LOGGING_LEVEL=debug APP_SERVER_PORT=9090 ./app
|
||||
```
|
||||
|
||||
## Logging
|
||||
|
||||
The application uses structured logging (JSON format) via the standard library's `log/slog` package.
|
||||
|
||||
### Log Levels
|
||||
|
||||
The supported log levels are:
|
||||
|
||||
* `debug`: Detailed information for debugging purposes.
|
||||
* `info`: General operational events (startup, shutdown, etc.).
|
||||
* `warn`: Non-critical errors or potential issues.
|
||||
* `error`: Critical errors that require attention.
|
||||
|
||||
The log level is configured via the `logging.level` setting in the configuration file or the `APP_LOGGING_LEVEL` environment variable.
|
||||
|
||||
### Log Output
|
||||
|
||||
Logs are output to `stdout` in JSON format to facilitate parsing by log management systems.
|
||||
|
||||
**Example Log Entry:**
|
||||
|
||||
```json
|
||||
{"time":"2023-10-27T10:00:00.123Z","level":"INFO","msg":"Starting application..."}
|
||||
```
|
||||
```
|
||||
24
docs/logging.md
Normal file
24
docs/logging.md
Normal file
@@ -0,0 +1,24 @@
|
||||
# Logging
|
||||
|
||||
The application uses structured logging (JSON format) via the standard library's `log/slog` package.
|
||||
|
||||
## Log Levels
|
||||
|
||||
The supported log levels are:
|
||||
|
||||
* `debug`: Detailed information for debugging purposes.
|
||||
* `info`: General operational events (startup, shutdown, etc.).
|
||||
* `warn`: Non-critical errors or potential issues.
|
||||
* `error`: Critical errors that require attention.
|
||||
|
||||
The log level is configured via the `logging.level` setting in the configuration file or the `APP_LOGGING_LEVEL` environment variable.
|
||||
|
||||
## Log Output
|
||||
|
||||
Logs are output to `stdout` in JSON format to facilitate parsing by log management systems.
|
||||
|
||||
**Example Log Entry:**
|
||||
|
||||
```json
|
||||
{"time":"2023-10-27T10:00:00.123Z","level":"INFO","msg":"Starting application..."}
|
||||
```
|
||||
Reference in New Issue
Block a user