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) ⇒ 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
# File 'lib/dry/logger/backends/stream.rb', line 24

def initialize(stream:, formatter:, level: DEFAULT_LEVEL, progname: nil, log_if: nil)
  super(stream, progname: progname)

  @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



36
37
38
# File 'lib/dry/logger/backends/stream.rb', line 36

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