Class: UniformNotifier::CustomizedLogger

Inherits:
Base
  • Object
show all
Defined in:
lib/uniform_notifier/customized_logger.rb

Class Method Summary collapse

Methods inherited from Base

inline_notify, wrap_js_association

Class Method Details

.active?Boolean

Returns:

  • (Boolean)


5
6
7
# File 'lib/uniform_notifier/customized_logger.rb', line 5

def self.active?
  @logger
end

.format_message(severity, timestamp, progname, msg) ⇒ Object



19
20
21
# File 'lib/uniform_notifier/customized_logger.rb', line 19

def @logger.format_message( severity, timestamp, progname, msg )
  "#{timestamp.strftime("%Y-%m-%d %H:%M:%S")}[#{severity}] #{msg}"
end

.out_of_channel_notify(message) ⇒ Object



9
10
11
12
# File 'lib/uniform_notifier/customized_logger.rb', line 9

def self.out_of_channel_notify( message )
  return unless active?
  @logger.warn message
end

.setup(logdev) ⇒ Object



14
15
16
17
18
19
20
21
22
# File 'lib/uniform_notifier/customized_logger.rb', line 14

def self.setup(logdev)
  require 'logger'

  @logger = Logger.new( logdev )

  def @logger.format_message( severity, timestamp, progname, msg )
    "#{timestamp.strftime("%Y-%m-%d %H:%M:%S")}[#{severity}] #{msg}"
  end
end