class Sw::Logger

Constants

VERSION

Public Class Methods

new(*) click to toggle source
Calls superclass method
# File lib/sw/logger.rb, line 27
def initialize(*)
  super
  self.formatter ||= Sw::LogFormatter::DefaultFormatter.new
end

Public Instance Methods

tagged(*tags) { |self| ... } click to toggle source
# File lib/sw/logger.rb, line 38
def tagged(*tags)
  tags = Array(tags).flatten
  return dup.tap { |it| it.formatter.tags = tags } unless block_given?

  formatter.with_tags(tags) { yield self }
end
with_context(context = {}) { |self| ... } click to toggle source
# File lib/sw/logger.rb, line 32
def with_context(context = {})
  return dup.tap { |it| it.formatter.context = context } unless block_given?

  formatter.with_context(context.to_h) { yield self }
end

Private Instance Methods

initialize_copy(original) click to toggle source
# File lib/sw/logger.rb, line 47
def initialize_copy(original)
  self.formatter = original.formatter.dup
end