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, out_of_channel_notify

Class Method Details

._out_of_channel_notify(data) ⇒ Object



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

def self._out_of_channel_notify( data )
  message = data.values.compact.join("\n")
  @logger.warn message
end

.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

.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