Class: Bwrap::Execution::Logging
- Inherits:
-
Object
- Object
- Bwrap::Execution::Logging
- Defined in:
- lib/bwrap/execution/logging.rb
Overview
Logging utilities for execution.
Class Method Summary collapse
-
.handle_logging(command, log_callback:, log:, dry_run:) ⇒ Object
Formats given command for logging, depending on dry-run flag.
Class Method Details
.handle_logging(command, log_callback:, log:, dry_run:) ⇒ Object
Formats given command for logging, depending on dry-run flag.
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/bwrap/execution/logging.rb', line 11 def self.handle_logging command, log_callback:, log:, dry_run: log_callback += 1 # This is another method in the chain, so need to add one. # The debug message contents will always be evaluated, so can just do it like this. log_command = calculate_log_command command if dry_run || Bwrap::Execution::Execute.dry_run puts "Would execute “#{log_command.force_encoding("UTF-8")}” at #{caller_locations(log_callback, 1)[0]}" return end return unless log msg = "Executing “#{log_command.force_encoding("UTF-8")}” at #{caller_locations(log_callback, 1)[0]}" Bwrap::Output.debug_output msg end |