Sha256: 91c9dcaadc2354dc98c424133f0143f21d0ae1f57ca5d15cdb4879342edb3fb8
Contents?: true
Size: 1.75 KB
Versions: 2
Compression:
Stored size: 1.75 KB
Contents
require 'rainbow' module Telemetry module Logger module Methods def colorize @colorize ||= if opts[:logfile].is_a?(String) false elsif opts.key? :color opts[:color] else true end end def debug(message = nil) return unless log.level < 1 message = yield if message.nil? && block_given? message = Rainbow(message).blue if colorize log.debug(message) end def info(message = nil) return unless log.level < 2 message = yield if message.nil? && block_given? message = Rainbow(message).green if colorize log.info(message) end def warn(message = nil) return unless log.level < 3 message = yield if message.nil? && block_given? message = Rainbow(message).yellow if colorize log.warn(message) end def error(message = nil) return unless log.level < 4 message = yield if message.nil? && block_given? message = Rainbow(message).red if colorize log.error(message) end def fatal(message = nil) return unless log.level < 5 message = yield if message.nil? && block_given? message = Rainbow(message).darkred if colorize log.fatal(message) end def unknown(message = nil) message = yield if message.nil? && block_given? message = Rainbow(message).purple if colorize log.unknown(message) end def thread(kvl: false, **_opts) if kvl "thread=#{Thread.current.object_id}" else Thread.current.object_id.to_s end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
telemetry-logger-0.2.0 | lib/telemetry/logger/methods.rb |
telemetry-logger-0.1.1 | lib/telemetry/logger/methods.rb |