Module: Grape::DSL::Logger

Includes:
Settings
Included in:
Configuration::ClassMethods
Defined in:
lib/grape/dsl/logger.rb

Instance Attribute Summary collapse

Attributes included from Settings

#inheritable_setting, #top_level_setting

Method Summary

Methods included from Settings

#api_class_setting, #get_or_set, #global_setting, #namespace_end, #namespace_inheritable, #namespace_inheritable_to_nil, #namespace_reverse_stackable, #namespace_reverse_stackable_with_hash, #namespace_setting, #namespace_stackable, #namespace_stackable_with_hash, #namespace_start, #route_end, #route_setting, #unset, #unset_api_class_setting, #unset_global_setting, #unset_namespace_inheritable, #unset_namespace_setting, #unset_namespace_stackable, #unset_route_setting, #within_namespace

Instance Attribute Details

#logger(logger = nil) ⇒ Object

Set or retrive the configured logger. If none was configured, this method will create a new one, logging to stdout.

Parameters:

  • logger (Object) (defaults to: nil)

    the new logger to use


11
12
13
14
15
16
17
# File 'lib/grape/dsl/logger.rb', line 11

def logger(logger = nil)
  if logger
    global_setting(:logger, logger)
  else
    global_setting(:logger) || global_setting(:logger, ::Logger.new($stdout))
  end
end