Sha256: 6e1731926b8323548ee98ed368d1289ec95241f7ad2ff14cdca5722c18872577

Contents?: true

Size: 639 Bytes

Versions: 6

Compression:

Stored size: 639 Bytes

Contents

# coding: utf-8
module Splash
  module Loggers


    class Daemon < Splash::Loggers::LoggerTemplate



      def initialize
        self.level = get_config.loggers[:level]
        @log_file = get_config.loggers[:daemon][:file]
        @stream = File::open(@log_file, 'a')
        @stream.sync = true
      end


      def log(options)
        level = (ALIAS.keys.include? options[:level])?  ALIAS[options[:level]] : options[:level]
        if @active_levels.include? level then
          @stream.puts "#{alt(options[:level])} #{options[:message]}"
        end
      end

      def close
        @stream.close
      end

    end

  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
prometheus-splash-0.4.5 lib/splash/loggers/daemon.rb
prometheus-splash-0.4.4 lib/splash/loggers/daemon.rb
prometheus-splash-0.4.3 lib/splash/loggers/daemon.rb
prometheus-splash-0.4.2 lib/splash/loggers/daemon.rb
prometheus-splash-0.4.1 lib/splash/loggers/daemon.rb
prometheus-splash-0.4.0 lib/splash/loggers/daemon.rb