vendor/bundle/ruby/2.6.0/gems/lumberjack-1.2.8/lib/lumberjack/logger.rb
# Add a message to the log with a given severity. The message can be either
# passed in the +message+ argument or supplied with a block. This method
# is not normally called. Instead call one of the helper functions
# +fatal+, +error+, +warn+, +info+, or +debug+.
#
# The severity can be passed in either as one of the Severity constants,
# or as a Severity label.
#
# === Example
#
#   logger.add_entry(Logger::ERROR, exception)
#   logger.add_entry(Logger::INFO, "Request completed")
#   logger.add_entry(:warn, "Request took a long time")
#   logger.add_entry(Logger::DEBUG){"Start processing with options #{options.inspect}"}
Add a message to the log with a given severity. The message can be either
passed in the +message+ argument or supplied with a block. This method
is not normally called.

The severity can be passed in either as one of the Severity constants,
or as a Severity label.

Example


Add a message to the log with a given severity . The message can be either passed in the + message + argument or supplied with a block . This method is not normally called . The severity can be passed in either as one of the Severity constants or as a Severity label . Example
def add_entry(severity, message, progname = nil, tags = nil)
      begin
        severity = Severity.label_to_level(severity) unless severity.is_a?(Integer)
        return true unless device && severity && severity >= level
        return true if Thread.current[:lumberjack_logging]
        Thread.current[:lumberjack_logging] = true
        time = Time.now
        message = message.call if message.is_a?(Proc)
        message = formatter.format(message)
        progname ||= self.progname
        current_tags = self.tags
        tags = nil unless tags.is_a?(Hash)
        if current_tags.empty?
          tags = Tags.stringify_keys(tags) unless tags.nil?
        else
          tags = if tags.nil?
            current_tags.dup
          else
            current_tags.merge(Tags.stringify_keys(tags))
          end
        end
        tags = Tags.expand_runtime_values(tags)
        tags = tag_formatter.format(tags) if tag_formatter
        entry = LogEntry.new(time, severity, message, progname, $$, tags)
        write_to_device(entry)
      ensure
        Thread.current[:lumberjack_logging] = nil
      end
      true
    end
def add_entry ( severity , message , progname = nil , tags = nil ) begin severity = Severity . label_to_level ( severity ) unless severity . is_a? ( Integer ) return true unless device && severity && severity >= level return true if Thread . current [ :lumberjack_logging ] Thread . current [ :lumberjack_logging ] = true time = Time . now message = message . call if message . is_a? ( Proc ) message = formatter . format ( message ) progname ||= self . progname current_tags = self . tags tags = nil unless tags . is_a? ( Hash ) if current_tags . empty? tags = Tags . stringify_keys ( tags ) unless tags . nil? else tags = if tags . nil? current_tags . dup else current_tags . merge ( Tags . stringify_keys ( tags ) ) end end tags = Tags . expand_runtime_values ( tags ) tags = tag_formatter . format ( tags ) if tag_formatter entry = LogEntry . new ( time , severity , message , progname , $$ , tags ) write_to_device ( entry ) ensure Thread . current [ :lumberjack_logging ] = nil end true end
Add a message to the log with a given severity.
Add a message to the log with a given severity .
severity
message
progname
tags