Module: Telemetry::Logger::Methods
- Included in:
- Telemetry::Logger
- Defined in:
- lib/telemetry/logger/methods.rb
Instance Method Summary collapse
- #colorize ⇒ Object
- #debug(message = nil) ⇒ Object
- #error(message = nil) ⇒ Object
- #fatal(message = nil) ⇒ Object
- #info(message = nil) ⇒ Object
- #thread(kvl: false, **_opts) ⇒ Object
- #unknown(message = nil) ⇒ Object
- #warn(message = nil) ⇒ Object
Instance Method Details
#colorize ⇒ Object
6 7 8 9 10 11 12 13 14 |
# File 'lib/telemetry/logger/methods.rb', line 6 def colorize @colorize ||= if opts[:logfile].is_a?(String) false elsif opts.key? :color opts[:color] else true end end |
#debug(message = nil) ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/telemetry/logger/methods.rb', line 16 def debug( = nil) return unless log.level < 1 = yield if .nil? && block_given? = Rainbow().blue if colorize log.debug() end |
#error(message = nil) ⇒ Object
40 41 42 43 44 45 46 |
# File 'lib/telemetry/logger/methods.rb', line 40 def error( = nil) return unless log.level < 4 = yield if .nil? && block_given? = Rainbow().red if colorize log.error() end |
#fatal(message = nil) ⇒ Object
48 49 50 51 52 53 54 |
# File 'lib/telemetry/logger/methods.rb', line 48 def fatal( = nil) return unless log.level < 5 = yield if .nil? && block_given? = Rainbow().darkred if colorize log.fatal() end |
#info(message = nil) ⇒ Object
24 25 26 27 28 29 30 |
# File 'lib/telemetry/logger/methods.rb', line 24 def info( = nil) return unless log.level < 2 = yield if .nil? && block_given? = Rainbow().green if colorize log.info() end |
#thread(kvl: false, **_opts) ⇒ Object
62 63 64 65 66 67 68 |
# File 'lib/telemetry/logger/methods.rb', line 62 def thread(kvl: false, **_opts) if kvl "thread=#{Thread.current.object_id}" else Thread.current.object_id.to_s end end |
#unknown(message = nil) ⇒ Object
56 57 58 59 60 |
# File 'lib/telemetry/logger/methods.rb', line 56 def unknown( = nil) = yield if .nil? && block_given? = Rainbow().purple if colorize log.unknown() end |
#warn(message = nil) ⇒ Object
32 33 34 35 36 37 38 |
# File 'lib/telemetry/logger/methods.rb', line 32 def warn( = nil) return unless log.level < 3 = yield if .nil? && block_given? = Rainbow().yellow if colorize log.warn() end |