Class: ActiveRdfLogger

Inherits:
Object
  • Object
show all
Defined in:
lib/active_rdf_log.rb

Class Method Summary collapse

Class Method Details

.log_add(message = nil, severity = Logger::DEBUG, context = nil) ⇒ Object

Logs a message of the given severity. The context may identify the class/ object that logged the message



37
38
39
40
41
42
# File 'lib/active_rdf_log.rb', line 37

def log_add(message = nil, severity = Logger::DEBUG, context = nil)
  logger.add(severity, nil, "ActiveRDF") do
    message = yield if(!message && block_given?)
    log_message(message, context)
  end
end

.loggerObject

Get the logger for the ActiveRDF library. This will default to the Rails logger if that is active. Otherwise it will use the configured logger for ActiveRDF. (Note that some messages may go to the configured logger if ActiveRDF is initialized before Rails).



24
25
26
# File 'lib/active_rdf_log.rb', line 24

def logger
  @logger ||= get_active_rdf_logger
end

.logger=(logger) ⇒ Object

Assign a new logger

Raises:

  • (ArgumentError)


29
30
31
32
33
# File 'lib/active_rdf_log.rb', line 29

def logger=(logger)
  raise(ArgumentError, "Empty Logger") if(logger == nil)
  @logger = logger
  @native_logger = false
end