Class: SingletonLogger

Inherits:
Logger
  • Object
show all
Defined in:
lib/dmorrill10-utils/singleton_logger.rb

Constant Summary collapse

@@log =
Logger.new(STDOUT)

Class Method Summary collapse

Class Method Details

.instanceObject



6
7
8
# File 'lib/dmorrill10-utils/singleton_logger.rb', line 6

def self.instance
  @@log
end

.respond_to_missing?(name, include_private = false) ⇒ Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/dmorrill10-utils/singleton_logger.rb', line 25

def self.respond_to_missing?(name, include_private=false)
  @@log.respond_to?(name, include_private) or super
end

.set_log_file!(file) ⇒ Object

Parameters:

  • file (IO)

    Log target file.



11
12
13
14
15
# File 'lib/dmorrill10-utils/singleton_logger.rb', line 11

def self.set_log_file!(file)
  @@log = Logger.new(file)

  self
end

.set_log_to_stderr!Object



21
22
23
# File 'lib/dmorrill10-utils/singleton_logger.rb', line 21

def self.set_log_to_stderr!
  set_log_file!(STDERR)
end

.set_log_to_stdout!Object



17
18
19
# File 'lib/dmorrill10-utils/singleton_logger.rb', line 17

def self.set_log_to_stdout!
  set_log_file!(STDOUT)
end