# frozen_string_literal: true require "dry/configurable" require "dry/logger" module Hanami class Config # Hanami logger config # # @api public # @since 2.0.0 class Logger include Dry::Configurable # @return [Hanami::SliceName] # # @api private # @since 2.0.o attr_reader :app_name # @!attribute [rw] level # Sets or returns the logger level. # # Defaults to `:info` for the production environment and `:debug` for all others. # # @return [Symbol] # # @api public # @since 2.0.0 setting :level # @!attribute [rw] stream # Sets or returns the logger's stream. # # This can be a file path or an `IO`-like object for the logger to write to. # # Defaults to `"log/test.log"` for the test environment and `$stdout` for all others. # # @return [String, #write] # # @api public # @since 2.0.0 setting :stream # @!attribute [rw] formatter # Sets or returns the logger's formatter. # # This may be a name that matches a formatter registered with `Dry::Logger`, which includes # `:string`, `:rack` and `:json`. # # This may also be an instance of Ruby's built-in `::Logger::Formatter` or any compatible # object. # # Defaults to `:json` for the production environment, and `:rack` for all others. # # @return [Symbol, ::Logger::Formatter] # # @api public # @since 2.0.0 setting :formatter # @!attribute [rw] template # Sets or returns log entry string template # # Defaults to `false`. # # @return [Boolean] # # @api public # @since 2.0.0 setting :template, default: "[%s] [%s] [%