Class: CerberusUtils::Log

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/cerberus_utils/log.rb

Overview

Singleton providing logging capabilities for the Cerberus Client Users can setup their own logger by calling Log.instance.setLoggingProvider and impelmenting the four log level output methods

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeLog

Called by Singleton to setup our instance - default logger instantiated can be replaced by the user



20
21
22
# File 'lib/cerberus_utils/log.rb', line 20

def initialize
  @logProvider = DefaultLogger.new
end

Instance Attribute Details

#logProviderObject (readonly)

Returns the value of attribute logProvider.



14
15
16
# File 'lib/cerberus_utils/log.rb', line 14

def logProvider
  @logProvider
end

Instance Method Details

#debug(msg) ⇒ Object

Log a debug message to the default logger



55
56
57
# File 'lib/cerberus_utils/log.rb', line 55

def debug(msg)
  @logProvider.debug(msg)
end

#error(msg) ⇒ Object

Log a error message to the default logger



34
35
36
# File 'lib/cerberus_utils/log.rb', line 34

def error(msg)
  @logProvider.error(msg)
end

#info(msg) ⇒ Object

Log a info message to the default logger



48
49
50
# File 'lib/cerberus_utils/log.rb', line 48

def info(msg)
  @logProvider.info(msg)
end

#setLoggingProvider(logProvider) ⇒ Object

Set the logger to be used by Cerberus Client



27
28
29
# File 'lib/cerberus_utils/log.rb', line 27

def setLoggingProvider(logProvider)
  @logProvider = logProvider
end

#warn(msg) ⇒ Object

Log a warning message to the default logger



41
42
43
# File 'lib/cerberus_utils/log.rb', line 41

def warn(msg)
  @logProvider.warn(msg)
end