LemonCore.Config.Logging (lemon_core v0.1.0)

View Source

Logging configuration for file output and log levels.

Inspired by Ironclaw's modular config pattern, this module handles logging-specific configuration including log file paths, levels, rotation settings, and compression options.

Configuration

Configuration is loaded from the TOML config file under [logging]:

[logging]
file = "./logs/lemon.log"
level = "debug"
max_no_bytes = 10485760
max_no_files = 5
compress_on_rotate = true
filesync_repeat_interval = 5000

Environment variables override file configuration:

  • LEMON_LOG_FILE
  • LEMON_LOG_LEVEL

Summary

Functions

Returns the default logging configuration as a map.

Resolves logging configuration from settings and environment variables.

Types

log_level()

@type log_level() :: :debug | :info | :warning | :error | nil

t()

@type t() :: %LemonCore.Config.Logging{
  compress_on_rotate: boolean() | nil,
  file: String.t() | nil,
  filesync_repeat_interval: integer() | nil,
  level: log_level(),
  max_no_bytes: integer() | nil,
  max_no_files: integer() | nil
}

Functions

defaults()

@spec defaults() :: map()

Returns the default logging configuration as a map.

This is used as the base configuration that gets overridden by user settings.

resolve(settings)

@spec resolve(map()) :: t()

Resolves logging configuration from settings and environment variables.

Priority: environment variables > TOML config > defaults