Class: Oca::Logger

Inherits:
Object
  • Object
show all
Defined in:
lib/oca-epak/logger.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ Logger

Receives a hash with keys ‘log`, `pretty_print_xml`, `log_level` and `logger`. `log_level` can be :info, :debug, :warn, :error or :fatal

Parameters:

  • opts (Hash) (defaults to: {})

Options Hash (opts):

  • :log (Boolean)
  • :pretty_print_xml (Boolean)
  • :log_level (Symbol)
  • :logger (Logger)


14
15
16
17
18
19
20
# File 'lib/oca-epak/logger.rb', line 14

def initialize(opts = {})
  @logger_options = {}
  @logger_options[:log] = opts[:log] || false
  @logger_options[:pretty_print_xml] = opts[:pretty_print_xml] || false
  @logger_options[:log_level] = opts[:log_level] || :info
  @logger_options[:logger] = opts[:logger] if opts[:logger]
end

Instance Attribute Details

#logger_optionsObject (readonly)

Returns the value of attribute logger_options.



3
4
5
# File 'lib/oca-epak/logger.rb', line 3

def logger_options
  @logger_options
end

Class Method Details

.optionsObject



26
27
28
29
# File 'lib/oca-epak/logger.rb', line 26

def self.options
  @logger ||= Oca::Logger.new
  @logger.logger_options
end

.options=(opts = {}) ⇒ Object



22
23
24
# File 'lib/oca-epak/logger.rb', line 22

def self.options=(opts = {})
  @logger = Oca::Logger.new(opts)
end