Module: OpenHAB::Log
- Defined in:
- lib/openhab/log.rb,
lib/openhab/log.rb
Overview
Provides access to the openHAB logging facilities using Ruby logging methods
Logging is available everywhere through the #logger object.
The logging prefix is ‘org.openhab.automation.jrubyscripting`.
Logging within file-based rules will have the name of the file appended to the logger name. Logging inside of a rule will have the id of the rule appended to the logger name. Any classes will have the full class name appended to the logger name.
Logging within UI-based rules will have the rule UID appended to the logger.
Class Method Summary collapse
-
.logger(object) ⇒ Logger
Retrieve a Logger for a particular object.
Class Method Details
.logger(object) ⇒ Logger
Retrieve a OpenHAB::Logger for a particular object.
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 |
# File 'lib/openhab/log.rb', line 92 def logger(object) case object when Module name = Logger::PREFIX klass = java_klass(object) name += ".#{klass.name.gsub("::", ".")}" if klass.name when String name = object when :main name = "#{Logger::PREFIX}.#{current_file}" name = "#{name}.#{$ctx["ruleUID"]}" if $ctx&.key?("ruleUID") return @loggers[name] ||= BiLogger.new(Logger.new(name)) end @loggers[name] ||= Logger.new(name) end |