class Binnacle::Logging::Formatter
Public Class Methods
new(client)
click to toggle source
# File lib/binnacle/logging/formatter.rb, line 6 def initialize(client) @client = client end
Public Instance Methods
assets_log_prefix()
click to toggle source
# File lib/binnacle/logging/formatter.rb, line 56 def assets_log_prefix @assets_log_prefix ||= "Started GET \"#{Rails.application.config.assets.prefix}" if defined?(Rails) end
call(severity, datetime, progname, msg)
click to toggle source
# File lib/binnacle/logging/formatter.rb, line 10 def call(severity, datetime, progname, msg) unless assets_log_prefix && msg.start_with?(assets_log_prefix) session_id, client_id = @client.session_and_client_ids event = Binnacle::Event.new() logging_tags = current_tags.dup if progname event.configure_from_logging_progname(progname, @client.logging_channel_id, client_id, session_id, severity, nil, datetime, [], { message: msg }) elsif defined?(ActiveSupport::TaggedLogging) && logging_tags && !logging_tags.empty? && logging_tags.size > 2 logging_tags.shift(2) event_name = logging_tags.shift event.configure_from_logging_progname(event_name, @client.logging_channel_id, client_id, session_id, severity, nil, datetime, logging_tags, { message: msg }) else event.configure(@client.logging_channel_id, 'log', client_id, session_id, severity, nil, datetime, [], { message: msg }) end event end end
tagged(*tags) { |self| ... }
click to toggle source
# File lib/binnacle/logging/formatter.rb, line 31 def tagged(*tags) new_tags = push_tags(*tags) yield self ensure pop_tags(new_tags.size) end