Class: Jekyll::LogWrapper

Inherits:
Object
  • Object
show all
Extended by:
Forwardable::Extended
Defined in:
lib/jekyll/log_wrapper.rb,
lib/jekyll/log_wrapper/version.rb

Constant Summary collapse

VERSION =
"1.0.0"

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(obj) ⇒ Jekyll::LogWrapper

– Initialize a new instance. –

Parameters:

  • logger (Jekyll::Logger)

    the logger



19
20
21
# File 'lib/jekyll/log_wrapper.rb', line 19

def initialize(obj)
  @logger = obj
end

Instance Attribute Details

#loggerObject (readonly)

Returns the value of attribute logger.



12
13
14
# File 'lib/jekyll/log_wrapper.rb', line 12

def logger
  @logger
end

Instance Method Details

#level=(val) ⇒ Symbol

– Wraps around Jekyll’s handling of log levels to translate

numbers into what they expect (:symbols) so that your
logger behaves as expected.

Returns:

  • (Symbol)

    because that’s what Jekyll does.



29
30
31
32
33
34
35
36
# File 'lib/jekyll/log_wrapper.rb', line 29

def level=(val)
  if val.is_a?(Integer)
    val = Logger::SEV_LABEL.fetch(val).
      downcase.to_sym
  end

  @logger.writer.level = val
end