Expand description
§Sets up logging by reading configuration from environment variables.
Environment variables used:
- LOG_MODE: “stdout” (default) or “file”
- LOG_LEVEL: log level (“trace”, “debug”, “info”, “warn”, “error”); default is “info”
- LOG_DATA_DIR: directory for log files; default is “logs/”
- LOG_MAX_SIZE: maximum size of log files in bytes; default is 1GB
- IN_DOCKER: “true” if running in Docker; default is “false”
Modules§
- Error handling utilities for the application.
Functions§
- Computes the path of the rolled log file given the base file path and the date string.
- Sets up logging by reading configuration from environment variables.
- Checks if the given log file exceeds the maximum allowed size (in bytes). If so, it appends a sequence number to generate a new file name. Returns the final log file path to use.