Sha256: be6fe300708bd684d20e2e32bbc88b0975ab940f1f78ed4ee616ed15665e6766

Contents?: true

Size: 599 Bytes

Versions: 12

Compression:

Stored size: 599 Bytes

Contents

require "logger"

class ZabbixRubyClient
  module Logger
    extend self

    def get_logger(dir, level)
      logger = ::Logger.new(File.join(dir,"zrc.log"))
      logger.level = get_level_constant(level)
      logger.formatter = proc do |severity, datetime, progname, msg|
        "[#{datetime.utc}] #{severity}: #{msg}\n"
      end
      logger
    end

    def get_level_constant(level)
      if level
        begin
          ::Logger.const_get(level.to_s.upcase)
        rescue NameError
          return ::Logger::INFO
        end
      else
        ::Logger::INFO
      end
    end

  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
zabbix-ruby-client-0.0.15 lib/zabbix-ruby-client/logger.rb
zabbix-ruby-client-0.0.14 lib/zabbix-ruby-client/logger.rb
zabbix-ruby-client-0.0.13 lib/zabbix-ruby-client/logger.rb
zabbix-ruby-client-0.0.12 lib/zabbix-ruby-client/logger.rb
zabbix-ruby-client-0.0.11 lib/zabbix-ruby-client/logger.rb
zabbix-ruby-client-0.0.10 lib/zabbix-ruby-client/logger.rb
zabbix-ruby-client-0.0.9 lib/zabbix-ruby-client/logger.rb
zabbix-ruby-client-0.0.8 lib/zabbix-ruby-client/logger.rb
zabbix-ruby-client-0.0.7 lib/zabbix-ruby-client/logger.rb
zabbix-ruby-client-0.0.6 lib/zabbix-ruby-client/logger.rb
zabbix-ruby-client-0.0.5 lib/zabbix-ruby-client/logger.rb
zabbix-ruby-client-0.0.4 lib/zabbix-ruby-client/logger.rb