Class: LetsEncrypt::LoggerProxy

Inherits:
Object
  • Object
show all
Defined in:
lib/letsencrypt/logger_proxy.rb

Overview

:nodoc:

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(logger, tags:) ⇒ LoggerProxy

Returns a new instance of LoggerProxy.



8
9
10
11
# File 'lib/letsencrypt/logger_proxy.rb', line 8

def initialize(logger, tags:)
  @logger = logger
  @tags = tags.flatten
end

Instance Attribute Details

#tagsObject (readonly)

Returns the value of attribute tags.



6
7
8
# File 'lib/letsencrypt/logger_proxy.rb', line 6

def tags
  @tags
end

Instance Method Details

#add_tags(*tags) ⇒ Object



13
14
15
16
# File 'lib/letsencrypt/logger_proxy.rb', line 13

def add_tags(*tags)
  @tags += tags.flatten
  @tags = @tags.uniq
end

#tag(logger) ⇒ Object



18
19
20
21
22
23
24
25
# File 'lib/letsencrypt/logger_proxy.rb', line 18

def tag(logger)
  if logger.respond_to?(:tagged)
    current_tags = tags - logger.formatter.current_tags
    logger.tagged(*current_tags) { yield }
  else
    yield
  end
end