Class: RokuBuilder::Logger

Inherits:
Object
  • Object
show all
Defined in:
lib/roku_builder/logger.rb

Constant Summary collapse

@@instance =
nil

Class Method Summary collapse

Class Method Details

.instanceObject



8
9
10
11
12
13
14
15
16
# File 'lib/roku_builder/logger.rb', line 8

def self.instance
  unless @@instance
    @@instance = ::Logger.new(STDOUT)
    @@instance.formatter = proc {|severity, datetime, _progname, msg|
      "[%s #%s] %5s: %s\n\r" % [datetime.strftime("%Y-%m-%d %H:%M:%S.%4N"), $$, severity, msg]
    }
  end
  @@instance
end

.set_debugObject



18
19
20
# File 'lib/roku_builder/logger.rb', line 18

def self.set_debug
  instance.level = ::Logger::DEBUG
end

.set_infoObject



21
22
23
# File 'lib/roku_builder/logger.rb', line 21

def self.set_info
  instance.level = ::Logger::INFO
end

.set_testingObject



28
29
30
# File 'lib/roku_builder/logger.rb', line 28

def self.set_testing
  @@instance = ::Logger.new(File::NULL)
end

.set_warnObject



24
25
26
# File 'lib/roku_builder/logger.rb', line 24

def self.set_warn
  instance.level = ::Logger::WARN
end