Class: Kamal::Output::BaseLogger
- Inherits:
-
Logger
- Object
- Logger
- Kamal::Output::BaseLogger
- Defined in:
- lib/kamal/output/base_logger.rb
Direct Known Subclasses
Instance Method Summary collapse
- #add(severity, message = nil, progname = nil, &block) ⇒ Object
- #close ⇒ Object
- #finish(name, id, payload) ⇒ Object
-
#initialize ⇒ BaseLogger
constructor
A new instance of BaseLogger.
- #start(name, id, payload) ⇒ Object
Constructor Details
#initialize ⇒ BaseLogger
Returns a new instance of BaseLogger.
4 5 6 7 |
# File 'lib/kamal/output/base_logger.rb', line 4 def initialize super(nil) @subscription = ActiveSupport::Notifications.subscribe("modify.kamal", self) end |
Instance Method Details
#add(severity, message = nil, progname = nil, &block) ⇒ Object
19 20 21 22 23 |
# File 'lib/kamal/output/base_logger.rb', line 19 def add(severity, = nil, progname = nil, &block) if msg = || (block ? block.call : progname) self << msg.to_s end end |
#close ⇒ Object
25 26 27 28 |
# File 'lib/kamal/output/base_logger.rb', line 25 def close ActiveSupport::Notifications.unsubscribe(@subscription) on_close end |
#finish(name, id, payload) ⇒ Object
14 15 16 17 |
# File 'lib/kamal/output/base_logger.rb', line 14 def finish(name, id, payload) runtime = (Process.clock_gettime(Process::CLOCK_MONOTONIC) - @started_at).round(1) on_finish(payload, runtime) end |
#start(name, id, payload) ⇒ Object
9 10 11 12 |
# File 'lib/kamal/output/base_logger.rb', line 9 def start(name, id, payload) @started_at = Process.clock_gettime(Process::CLOCK_MONOTONIC) on_start(payload) end |