class TTY::Logger::Config
Constants
- FILTERED
Attributes
The format used for date display. uses strftime format
Allow to overwirte filters
The format used for displaying structured data
The handlers used to display logging info. Defaults to [:console]
The level to log messages at. Default to :info
The maximum message size to be logged in bytes. Defaults to 8192
The maximum depth for formatting array and hash objects. Defaults to 3
The meta info to display, can be :date, :time, :file, :pid. Defaults to []
The output for the log messages. Defaults to `stderr`
The format used for time display. uses strftime format
The new custom log types. Defaults to `{}`
Public Class Methods
Create a configuration instance
@api private
# File lib/tty/logger/config.rb, line 43 def initialize(**options) @max_bytes = options.fetch(:max_bytes) { 2**13 } @max_depth = options.fetch(:max_depth) { 3 } @level = options.fetch(:level) { :info } @metadata = options.fetch(:metadata) { [] } @handlers = options.fetch(:handlers) { [:console] } @formatter = options.fetch(:formatter) { :text } @date_format = options.fetch(:date_format) { "%F" } @time_format = options.fetch(:time_format) { "%T.%3N" } @output = options.fetch(:output) { $stderr } @types = options.fetch(:types) { {} } end
Public Instance Methods
The filters to hide sensitive data from the message(s) and data.
@return [FiltersProvider]
@api public
# File lib/tty/logger/config.rb, line 79 def filters @filters ||= FiltersProvider.new end
Hash representation of this config
@return [Hash]
@api public
# File lib/tty/logger/config.rb, line 111 def to_h { date_format: date_format, filters: filters.to_h, formatter: formatter, handlers: handlers, level: level, max_bytes: max_bytes, max_depth: max_depth, metadata: metadata, output: output, time_format: time_format, types: types } end
Clone settings
@api public
# File lib/tty/logger/config.rb, line 89 def to_proc -> (config) { config.date_format = @date_format.dup config.time_format = @time_format.dup config.filters = @filters.dup config.formatter = @formatter config.handlers = @handlers.dup config.level = @level config.max_bytes = @max_bytes config.max_depth = @max_depth config.metadata = @metadata.dup config.output = @output.dup config.types = @types.dup config } end