Class: Dry::Logger::Backends::Stream

Inherits:
Logger
  • Object
show all
Includes:
Core
Defined in:
lib/dry/logger/backends/stream.rb

Direct Known Subclasses

File, IO

Instance Attribute Summary collapse

Attributes included from Core

#log_if

Instance Method Summary collapse

Methods included from Core

#log?

Constructor Details

#initialize(stream:, formatter:, level: DEFAULT_LEVEL, progname: nil, log_if: nil, shift_age: nil, shift_size: nil, **logger_options) ⇒ Stream

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Stream.

Since:

  • 0.1.0



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/dry/logger/backends/stream.rb', line 24

def initialize( # rubocop:disable Style/ParameterLists
  stream:,
  formatter:,
  level: DEFAULT_LEVEL,
  progname: nil,
  log_if: nil,
  shift_age: nil,
  shift_size: nil,
  **logger_options
)
  super(
    stream,
    shift_age,
    shift_size,
    progname: progname,
    **logger_options
  )

  @stream = stream
  @level = LEVELS[level]

  self.log_if = log_if
  self.formatter = formatter
end

Instance Attribute Details

#levelObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Since:

  • 0.1.0



20
21
22
# File 'lib/dry/logger/backends/stream.rb', line 20

def level
  @level
end

#streamObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Since:

  • 0.1.0



16
17
18
# File 'lib/dry/logger/backends/stream.rb', line 16

def stream
  @stream
end

Instance Method Details

#inspectObject

Since:

  • 1.0.0



51
52
53
# File 'lib/dry/logger/backends/stream.rb', line 51

def inspect
  %(#<#{self.class} stream=#{stream} level=#{level} log_if=#{log_if}>)
end