Sha256: 65d011c6c381d2bf9d14e6fdbe1ae4841842c99fbda8355571dd3a48cf3a045a

Contents?: true

Size: 357 Bytes

Versions: 2

Compression:

Stored size: 357 Bytes

Contents

require_relative "../lib/tty/logger"

class MyHandler
  def initialize(options = {})
    @name = options[:name]
  end

  def call(event)
    puts "(#{@name}) #{event.metadata[:name]} #{event.message}"
  end
end

TTY::Logger.configure do |config|
  config.handlers = [[MyHandler, {name: :hello}]]
end

logger = TTY::Logger.new

logger.info("Custom logging")

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
tty-logger-0.2.0 examples/handler.rb
tty-logger-0.1.0 examples/handler.rb