Sha256: 2d05eb417cf3b3ed6dd8f5d39f403cfed3d87921d68db1fb0f91069f2ef5bef8

Contents?: true

Size: 569 Bytes

Versions: 30

Compression:

Stored size: 569 Bytes

Contents

require 'syslog'
require 'syslog/logger'

class WdLogger < Logger
  SYSLOG_NAME = 'sys_watchdog'

  def initialize *args
    @syslog = Syslog::Logger.new SYSLOG_NAME
    super
  end

  def add(severity, message = nil, progname = nil, &block)
    super

    if message.nil?
      if block_given?
        message = yield
      else
        message = progname
      end
    end

    added severity, message
  end

  def added severity, message
    if severity >= Logger::WARN
      @syslog.send Logger::Severity::constants[severity].downcase, message
    end
  end

end

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
sys_watchdog-0.1.20 lib/sys_watchdog/wd_logger.rb
sys_watchdog-0.1.19 lib/sys_watchdog/wd_logger.rb
sys_watchdog-0.1.18 lib/sys_watchdog/wd_logger.rb
sys_watchdog-0.1.17 lib/sys_watchdog/wd_logger.rb
sys_watchdog-0.1.16 lib/sys_watchdog/wd_logger.rb
sys_watchdog-0.1.15 lib/sys_watchdog/wd_logger.rb
sys_watchdog-0.1.14 lib/sys_watchdog/wd_logger.rb
sys_watchdog-0.1.13 lib/sys_watchdog/wd_logger.rb
sys_watchdog-0.1.12 lib/sys_watchdog/wd_logger.rb
sys_watchdog-0.1.11 lib/sys_watchdog/wd_logger.rb
sys_watchdog-0.1.10 lib/sys_watchdog/wd_logger.rb
sys_watchdog-0.1.9 lib/sys_watchdog/wd_logger.rb
sys_watchdog-0.1.8 lib/sys_watchdog/wd_logger.rb
sys_watchdog-0.1.7 lib/sys_watchdog/wd_logger.rb
sys_watchdog-0.1.6 lib/sys_watchdog/wd_logger.rb
sys_watchdog-0.1.5 lib/sys_watchdog/wd_logger.rb
sys_watchdog-0.1.4 lib/sys_watchdog/wd_logger.rb
sys_watchdog-0.1.3 lib/sys_watchdog/wd_logger.rb
sys_watchdog-0.1.2 lib/sys_watchdog/wd_logger.rb
sys_watchdog-0.1.1 lib/sys_watchdog/wd_logger.rb