class Logbuch::Configuration

Overview

The receiver of the block Logbuch.configure runs, which changes the settings it names and leaves the others as they are.

Logbuch.configure do
  max_depth 3
  max_length 256, env: false
end

Each setting has an environment variable, such as LOGBUCH_MAX_DEPTH, which overrides the value set here; use_env false, or env: false on one setter, switches that off. A program built with -Dlogbuch=off only type-checks the block and keeps the defaults.

Defined in:

logbuch/settings.cr

Instance Method Summary

Instance methods inherited from class Reference

inspect(io : IO) : Nil inspect

Instance methods inherited from class Object

to_trace(tracer : Logbuch::Tracer) : Log::Metadata::Value to_trace

Instance Method Detail

def max_cap(value : Int, *, env : Bool | Nil = nil) : Nil #

Sets Settings#max_cap, from 0 to UInt32::MAX, and switches LOGBUCH_MAX_CAP like #max_depth.


[View source]
def max_depth(value : Int, *, env : Bool | Nil = nil) : Nil #

Sets Settings#max_depth, from 0 to DEPTH_CEILING. env: false makes it ignore LOGBUCH_MAX_DEPTH, and env: true makes it read that again. Takes any integer type, such as an Int32 variable, and raises ArgumentError for a value out of range, a negative one included.


[View source]
def max_length(value : Int, *, env : Bool | Nil = nil) : Nil #

Sets Settings#max_length, from 0 to UInt32::MAX, and switches LOGBUCH_MAX_LENGTH like #max_depth.


[View source]
def use_env(enabled : Bool) : Nil #

Whether the settings read their environment variables: use_env false makes every setting ignore its variable, also one applied already, and use_env true reads them again, except where a setter said env: false.


[View source]