Sha256: 11bb1e0ca7b2d8ea74845ee8723964074b4181791d05b9b6842c686623ccd82c

Contents?: true

Size: 725 Bytes

Versions: 8

Compression:

Stored size: 725 Bytes

Contents

class Radiosonde::Logger < ::Logger
  include Singleton

  def initialize
    super($stdout)

    self.formatter = proc do |severity, datetime, progname, msg|
      "#{msg}\n"
    end

    self.level = Logger::INFO
  end

  def set_debug(value)
    self.level = value ? Logger::DEBUG : Logger::INFO
  end

  module Helper
    def log(level, message, color, log_id = nil)
      message = "[#{level.to_s.upcase}] #{message}" unless level == :info
      message << ": #{log_id}" if log_id
      message << ' (dry-run)' if @options && @options[:dry_run]
      logger = (@options && @options[:logger]) || Radiosonde::Logger.instance
      message = message.send(color) if color
      logger.send(level, message)
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
radiosonde-0.2.0.beta5 lib/radiosonde/logger.rb
radiosonde-0.2.0.beta4 lib/radiosonde/logger.rb
radiosonde-0.2.0.beta3 lib/radiosonde/logger.rb
radiosonde-0.2.0.beta2 lib/radiosonde/logger.rb
radiosonde-0.2.0.beta lib/radiosonde/logger.rb
radiosonde-0.1.1 lib/radiosonde/logger.rb
radiosonde-0.1.0 lib/radiosonde/logger.rb
radiosonde-0.0.8 lib/radiosonde/logger.rb