Class: LocalPac::UiLogger

Inherits:
Object
  • Object
show all
Defined in:
lib/local_pac/ui_logger.rb

Instance Method Summary collapse

Constructor Details

#initializeUiLogger

Returns a new instance of UiLogger.



3
4
5
# File 'lib/local_pac/ui_logger.rb', line 3

def initialize
  @logger = ::Logger.new($stderr)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args, &block) ⇒ Object



26
27
28
# File 'lib/local_pac/ui_logger.rb', line 26

def method_missing(method, *args, &block)
  @logger.public_send method, *args
end

Instance Method Details

#level=(l) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/local_pac/ui_logger.rb', line 7

def level=(l)
  @logger.level = case l.to_s.to_sym
                  when :unknown
                    ::Logger::UNKNOWN
                  when :fatal
                    ::Logger::FATAL
                  when :error
                    ::Logger::ERROR
                  when :warn
                    ::Logger::WARN
                  when :info
                    ::Logger::INFO
                  when :debug
                    ::Logger::DEBUG
                  else
                    ::Logger::ERROR
                  end
end