Class: Fyi::Notifier::Log
- Inherits:
-
Object
- Object
- Fyi::Notifier::Log
- Defined in:
- lib/fyi/notifiers/log.rb
Overview
Logs command execution to a file.
The log level depends on the execution result: INFO if the command succeeded, WARN if it failed.
Instance Attribute Summary collapse
-
#logger ⇒ Object
readonly
Returns the value of attribute logger.
Instance Method Summary collapse
-
#initialize(options) ⇒ Log
constructor
Options you can supply:
file
: full path to a log file. - #notify(command, result, duration, output, error = '', host = '') ⇒ Object
Constructor Details
#initialize(options) ⇒ Log
Options you can supply: file
: full path to a log file. Defaults to fyi.log
in the process’s home directory.
15 16 17 18 |
# File 'lib/fyi/notifiers/log.rb', line 15 def initialize log_file = ['file'] || default_log_file @logger = Logger.new log_file end |
Instance Attribute Details
#logger ⇒ Object (readonly)
Returns the value of attribute logger.
10 11 12 |
# File 'lib/fyi/notifiers/log.rb', line 10 def logger @logger end |
Instance Method Details
#notify(command, result, duration, output, error = '', host = '') ⇒ Object
20 21 22 |
# File 'lib/fyi/notifiers/log.rb', line 20 def notify command, result, duration, output, error = '', host = '' logger.log severity(result), (command, result, duration, output, error, host) end |