Sha256: 85f6c73efbf44a4b1970db3963cc038ff255a8da35d82ed7ce0f1a474da54cea
Contents?: true
Size: 918 Bytes
Versions: 2
Compression:
Stored size: 918 Bytes
Contents
# frozen_string_literal: true require 'active_support' module FluentLoggerRails class Logger < ::ActiveSupport::Logger def initialize(logger, path:, level:) @level = SEV_LABEL.index(level.to_s.upcase) @path = path @logger = logger after_initialize if respond_to? :after_initialize end def add(severity, message = nil, progname = nil) return true if severity < @level message = (block_given? ? yield : progname) if message.blank? return true if message.blank? message = format_message(severity, Time.zone.now, progname, message) @logger.post(@path, message) true end def close @logger.close end delegate :add_tags, :remove_tags, :clear_tags!, to: :formatter def tagged(*tags) formatter.tagged(*tags) { yield self } end def flush clear_tags! super if defined?(super) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
fluent_logger_rails-0.3.0 | lib/fluent_logger_rails/logger.rb |
fluent_logger_rails-0.2.0 | lib/fluent_logger_rails/logger.rb |