Sha256: 35154e969225f3af440f59c38effdaf864ce9afc99127bf09670882fd8243777

Contents?: true

Size: 492 Bytes

Versions: 4

Compression:

Stored size: 492 Bytes

Contents

require "logger"

module Salus
  # Loosely based on code from https://github.com/ruby-concurrency/concurrent-ruby/
  module Logging
    include Logger::Severity

    def log(level, message = nil, progname = nil, &block)
      (@logger || Salus.logger).add level, message, progname, &block
    rescue => error
      $stderr.puts "Failed to log #{[level, progname, message, block]}\n" +
        "#{error.message} (#{error.class})\n#{error.backtrace.join "\n"}"
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
salus-0.2.1 lib/salus/logging.rb
salus-0.2.0 lib/salus/logging.rb
salus-0.1.3 lib/salus/logging.rb
salus-0.1.2 lib/salus/logging.rb