Class: Stickler::Logging

Inherits:
Object
  • Object
show all
Defined in:
lib/stickler/logable.rb

Class Method Summary collapse

Class Method Details

.initObject



13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/stickler/logable.rb', line 13

def self.init
  unless @initialized then
    layout   = ::Logging::Layouts::Pattern.new( :pattern => "%5l %c : %m" )
    appender = ::Logging::Appenders::Syslog.new( Stickler.app_name,
                                                :logopt => ::Syslog::Constants::LOG_CONS | ::Syslog::Constants::LOG_PID,
                                                :facility => ::Syslog::Constants::LOG_LOCAL0,
                                                :layout => layout)
    ::Logging::Appenders['syslog'] = appender
    logger = ::Logging::Logger[Stickler]
    logger.add_appenders( appender )
    @initialized = true
  end
  return @initialized
end