Sha256: 1e8c2ca6c3a083224b610d7f28c4f0fd1a369b765c70093f615ff3be3dd8ae60

Contents?: true

Size: 1.01 KB

Versions: 1

Compression:

Stored size: 1.01 KB

Contents

# frozen_string_literal: true

require 'trifle/logger/configuration'
require 'trifle/logger/tracer/hash'
require 'trifle/logger/tracer/null'
require 'trifle/logger/middleware/rack'
require 'trifle/logger/middleware/rails_controller'
require 'trifle/logger/middleware/sidekiq'
require 'trifle/logger/version'

module Trifle
  module Logger
    class Error < StandardError; end
    # Your code goes here...

    def self.default
      @default ||= Configuration.new
    end

    def self.configure
      yield(default)

      default
    end

    def self.tracer=(tracer)
      Thread.current[:trifle_tracer] = tracer
    end

    def self.tracer
      Thread.current[:trifle_tracer]
    end

    def self.trace(*args, **keywords, &block)
      if tracer.nil?
        return block_given? ? yield : nil
      end

      tracer.trace(*args, **keywords, &block)
    end

    def self.tag(tag)
      return unless tracer

      tracer.tag(tag)
    end

    def self.fail!
      return unless tracer

      tracer.fail!
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
trifle-logger-0.0.2 lib/trifle/logger.rb