Sha256: 69cc7cd249a96cb62d2f4fd64063ddd3eedae738a9688495027778d85ada2b09

Contents?: true

Size: 881 Bytes

Versions: 4

Compression:

Stored size: 881 Bytes

Contents

module Legion
  module Logging
    module Builder
      def log_format(_options = {}, log = @log)
        log.formatter = proc do |severity, datetime, _progname, msg|
          "[#{datetime}][#{::Process.pid}] #{severity} #{msg}\n"
        end
      end

      def output(options)
        @log = ::Logger.new($stdout) if options[:log_file].nil?
        @log = ::Logger.new(options[:log_file]) unless options[:log_file].nil?
      end

      def log_level(level = 'debug', log = @log)
        if level == 'debug'
          log.level = ::Logger::DEBUG
        elsif level == 'info'
          log.level = ::Logger::INFO
        elsif level == 'warn'
          log.level = ::Logger::WARN
        elsif level == 'error'
          log.level = ::Logger::ERROR
        elsif level == 'fatal'
          log.level = ::Logger::FATAL
        end
        @log = log
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
legion-logging-0.3.1 lib/legion/logging/builder.rb
legion-logging-0.1.4 lib/legion/logging/builder.rb
legion-logging-0.1.3 lib/legion/logging/builder.rb
legion-logging-0.1.2 lib/legion/logging/builder.rb