Sha256: faf4f0cd265e8f75ccf8ddae555038e58fc5f33d74b12e7ee82a575d2cbeee30

Contents?: true

Size: 615 Bytes

Versions: 41

Compression:

Stored size: 615 Bytes

Contents

# (c) Copyright IBM Corp. 2021
# (c) Copyright Instana Inc. 2021

module Instana
  class InstrumentedLogger < Logger
    LEVEL_LABELS = %w[Debug Info Warn Error Fatal Any].freeze

    def instana_log_level
      WARN
    end

    def add(severity, message = nil, progname = nil)
      severity ||= UNKNOWN

      if severity >= instana_log_level && ::Instana.tracer.tracing?
        tags = {
          level: LEVEL_LABELS[severity],
          message: "#{message} #{progname}".strip
        }
        Instana::Tracer.trace(:log, {log: tags}) {}
      end

      super(severity, message, progname)
    end
  end
end

Version data entries

41 entries across 41 versions & 1 rubygems

Version Path
instana-1.217.1 lib/instana/instrumented_logger.rb
instana-1.217.0 lib/instana/instrumented_logger.rb
instana-1.216.0 lib/instana/instrumented_logger.rb
instana-1.215.1 lib/instana/instrumented_logger.rb
instana-1.215.0 lib/instana/instrumented_logger.rb
instana-1.214.4 lib/instana/instrumented_logger.rb
instana-1.214.3 lib/instana/instrumented_logger.rb
instana-1.214.2 lib/instana/instrumented_logger.rb
instana-1.214.1 lib/instana/instrumented_logger.rb
instana-1.214.0 lib/instana/instrumented_logger.rb
instana-1.213.3 lib/instana/instrumented_logger.rb
instana-1.213.2 lib/instana/instrumented_logger.rb
instana-1.213.1 lib/instana/instrumented_logger.rb
instana-1.213.0 lib/instana/instrumented_logger.rb
instana-1.212.0 lib/instana/instrumented_logger.rb
instana-1.211.0 lib/instana/instrumented_logger.rb
instana-1.210.1 lib/instana/instrumented_logger.rb
instana-1.210.0 lib/instana/instrumented_logger.rb
instana-1.209.8 lib/instana/instrumented_logger.rb
instana-1.209.7 lib/instana/instrumented_logger.rb