Class: JobManager::ApplicationLogger
- Inherits:
-
IO
- Object
- IO
- JobManager::ApplicationLogger
- Defined in:
- lib/jobmanager/applicationlogger.rb
Overview
This class is a base class for all of the ApplicationLogger* classes implemented in this file. This class should not be instantiated directly. This class derives from IO so that it can reuse the print methods (print, <<, puts, etc).
Direct Known Subclasses
Constant Summary collapse
- LEVEL_LOGGER_MAP =
This constant is a map between the shortcut methods in the Logger interface (debug, info, warn, etc) and their associated severity constants.
SyslogLogger::LOGGER_LEVEL_MAP.invert
Instance Attribute Summary collapse
-
#job_name ⇒ Object
Returns the value of attribute job_name.
-
#user_name ⇒ Object
Returns the value of attribute user_name.
Instance Method Summary collapse
-
#initialize(job_name, user_name) ⇒ ApplicationLogger
constructor
A new instance of ApplicationLogger.
-
#record_exception(e) ⇒ Object
Description: This method logs the given exception.
-
#record_tagged_exception(message, e) ⇒ Object
Description: This method logs the given exception and the associated tag.
-
#write(message) ⇒ Object
Description: This method logs a message with severity level Logger::INFO.
Constructor Details
#initialize(job_name, user_name) ⇒ ApplicationLogger
Returns a new instance of ApplicationLogger.
28 29 30 31 |
# File 'lib/jobmanager/applicationlogger.rb', line 28 def initialize(job_name, user_name) @job_name = job_name ? job_name : "UNKNOWN" @user_name = user_name end |
Instance Attribute Details
#job_name ⇒ Object
Returns the value of attribute job_name.
25 26 27 |
# File 'lib/jobmanager/applicationlogger.rb', line 25 def job_name @job_name end |
#user_name ⇒ Object
Returns the value of attribute user_name.
26 27 28 |
# File 'lib/jobmanager/applicationlogger.rb', line 26 def user_name @user_name end |
Instance Method Details
#record_exception(e) ⇒ Object
Description:
This method logs the given exception.
37 38 39 40 |
# File 'lib/jobmanager/applicationlogger.rb', line 37 def record_exception(e) error(e.) debug(e.backtrace.join("\n")) end |
#record_tagged_exception(message, e) ⇒ Object
Description:
This method logs the given exception and the associated tag.
46 47 48 49 |
# File 'lib/jobmanager/applicationlogger.rb', line 46 def record_tagged_exception(, e) error("#{}: Error (#{e.class}): #{e.}") debug(e.backtrace.join("\n")) end |
#write(message) ⇒ Object
Description:
This method logs a message with severity level Logger::INFO.
55 56 57 |
# File 'lib/jobmanager/applicationlogger.rb', line 55 def write() info() end |