Module: Clerk::Logger::ClassMethods

Defined in:
lib/clerk/logger.rb

Instance Method Summary collapse

Instance Method Details

#clerk_always_include(*new_default_fields) ⇒ Object



15
16
17
18
19
20
21
# File 'lib/clerk/logger.rb', line 15

def clerk_always_include(*new_default_fields)
  new_default_fields.each do |default_field|
    default_field = { default_field => default_field } unless default_field.is_a?(Hash)
    Clerk::Log.send(:field, default_field.values.first)
    default_fields.merge!(default_field)
  end
end

#default_fieldsObject



6
7
8
9
10
11
12
13
# File 'lib/clerk/logger.rb', line 6

def default_fields
  @default_fields ||=
    if superclass.respond_to?(:default_fields)
      superclass.default_fields.dup
    else
      {}
    end
end