Class: Loglevel::LoggableClass

Inherits:
Object
  • Object
show all
Defined in:
lib/loglevel/loggable_class.rb,
lib/loglevel/loggable_class/level.rb,
lib/loglevel/loggable_class/smart_logger.rb

Overview

An instance of a class that can be logged, i.e. has a #logger and a #logger= method

Defined Under Namespace

Classes: Level, SmartLogger

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#class_nameObject (readonly) Also known as: to_s

Returns the value of attribute class_name.



8
9
10
# File 'lib/loglevel/loggable_class.rb', line 8

def class_name
  @class_name
end

#loggerObject

Returns the value of attribute logger.



8
9
10
# File 'lib/loglevel/loggable_class.rb', line 8

def logger
  @logger
end

Instance Method Details

#active_record?Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/loglevel/loggable_class.rb', line 19

def active_record?
  @active_record ||= canonical_name == '::ActiveRecord::Base'
end

#checkObject



11
12
13
# File 'lib/loglevel/loggable_class.rb', line 11

def check
  # No checks implemented yet
end

#debugObject



27
28
29
# File 'lib/loglevel/loggable_class.rb', line 27

def debug
  { name: class_name, logger: logger.class, level: level.level_name }
end

#http?Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/loglevel/loggable_class.rb', line 23

def http?
  @http ||= canonical_name == '::HttpLogger'
end

#levelObject



15
16
17
# File 'lib/loglevel/loggable_class.rb', line 15

def level
  @level ||= Level.new(self)
end