Module: VivlioStarter::Pdf::LogHelper

Defined in:
lib/vivlio_starter/cli/pdf/log_helper.rb

Overview

Logging helper that integrates with vivlio-starter CLI when available

Class Method Summary collapse

Class Method Details

.dispatch(method, message) ⇒ Object



29
30
31
32
33
34
35
# File 'lib/vivlio_starter/cli/pdf/log_helper.rb', line 29

def dispatch(method, message)
  if defined?(VivlioStarter::CLI::Common)
    VivlioStarter::CLI::Common.public_send(method, message)
  else
    yield if block_given?
  end
end

.log_action(message) ⇒ Object



9
10
11
# File 'lib/vivlio_starter/cli/pdf/log_helper.rb', line 9

def log_action(message)
  dispatch(:log_action, message) { puts(message) }
end

.log_error(message) ⇒ Object



25
26
27
# File 'lib/vivlio_starter/cli/pdf/log_helper.rb', line 25

def log_error(message)
  dispatch(:log_error, message) { warn(message) }
end

.log_info(message) ⇒ Object



13
14
15
# File 'lib/vivlio_starter/cli/pdf/log_helper.rb', line 13

def log_info(message)
  dispatch(:log_info, message) { puts(message) }
end

.log_success(message) ⇒ Object



17
18
19
# File 'lib/vivlio_starter/cli/pdf/log_helper.rb', line 17

def log_success(message)
  dispatch(:log_success, message) { puts(message) }
end

.log_warn(message) ⇒ Object



21
22
23
# File 'lib/vivlio_starter/cli/pdf/log_helper.rb', line 21

def log_warn(message)
  dispatch(:log_warn, message) { warn(message) }
end