Sha256: b4cca415aa4bc8bb3711f6ccea6290e04b613b32cfbfcc8bec9f91e362d2bfda

Contents?: true

Size: 488 Bytes

Versions: 7

Compression:

Stored size: 488 Bytes

Contents

# frozen_string_literal: true

module Trifle
  module Logger
    class Configuration
      attr_accessor :tracer_klass, :callbacks

      def initialize
        @tracer_klass = Trifle::Logger::Tracer::Hash
        @callbacks = {
          wrapup: []
        }
      end

      def on_wrapup(tracer)
        @callbacks.fetch(:wrapup, []).each do |c|
          c.call(tracer)
        end
      end

      def on(event, &block)
        @callbacks[event] << block
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
trifle-logger-0.1.4 lib/trifle/logger/configuration.rb
trifle-logger-0.1.3 lib/trifle/logger/configuration.rb
trifle-logger-0.1.2 lib/trifle/logger/configuration.rb
trifle-logger-0.1.1 lib/trifle/logger/configuration.rb
trifle-logger-0.1.0 lib/trifle/logger/configuration.rb
trifle-logger-0.0.2 lib/trifle/logger/configuration.rb
trifle-logger-0.0.1 lib/trifle/logger/configuration.rb