Module: Roda::RodaPlugins::ReeLogger

Defined in:
lib/ree_lib/packages/ree_roda/package/ree_roda/plugins/ree_logger.rb

Overview

The ree_logger plugin adds ReeLogger support to Roda

Example:

plugin :ree_logger
plugin :ree_logger, log_params: true, filter: -> { request.path.include?("health") }

Defined Under Namespace

Modules: InstanceMethods

Constant Summary collapse

REE_LOGGER_DEFAULTS =
{
  method: :info,
  log_params: true
}

Class Method Summary collapse

Class Method Details

.configure(app, **opts) ⇒ Object



17
18
19
20
21
22
# File 'lib/ree_lib/packages/ree_roda/package/ree_roda/plugins/ree_logger.rb', line 17

def self.configure(app, **opts)
  opts = REE_LOGGER_DEFAULTS.merge(opts)
  app.opts[:ree_logger] = ::ReeLogger::Logger.new
  app.opts[:ree_logger_filter] = opts[:filter] if opts[:filter]
  app.opts[:ree_logger_log_params] = !!opts[:log_params]
end

.start_timerObject



24
25
26
# File 'lib/ree_lib/packages/ree_roda/package/ree_roda/plugins/ree_logger.rb', line 24

def self.start_timer
  Process.clock_gettime(Process::CLOCK_MONOTONIC)
end