Class: Middleware::Logger

Inherits:
Object
  • Object
show all
Defined in:
lib/airfoil/logger_patch.rb

Overview

The built-in Middleware gem logger truncates the event so instead we have our own logging middleware to print the event and context. Here, we reopen the class and ignoring the partial event to cut down on log chatter.

Instance Method Summary collapse

Instance Method Details

#way_in_message(name, env) ⇒ Object



5
6
7
# File 'lib/airfoil/logger_patch.rb', line 5

def way_in_message name, env
  " %s has been called with: %s" % [name, env[:context].function_name]
end

#write(msg) ⇒ Object

Default to omitting middleware logging



10
11
12
13
14
# File 'lib/airfoil/logger_patch.rb', line 10

def write msg
  if ENV["MIDDLEWARE_LOGGING_ENABLED"] == "true"
    @write_to.add(::Logger::INFO, msg.slice(0, 255).strip!, @middleware_name)
  end
end