Module: GitWorkflow::Logging::ClassMethods

Included in:
Callbacks::Loader
Defined in:
lib/git_workflow/logging.rb

Instance Method Summary collapse

Instance Method Details

#log(level, message, &block) ⇒ Object



60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/git_workflow/logging.rb', line 60

def log(level, message, &block)
  if block_given?
    begin
      logger.send(level, "(start): #{ message }")
      rc = yield
      logger.send(level, "(finish): #{ message }")
      rc
    rescue => exception
      logger.error("#{ message } (#{ exception.message })")
      raise
    end
  else
    logger.send(level, message)
  end
end

#loggerObject



56
57
58
# File 'lib/git_workflow/logging.rb', line 56

def logger
  @logger || GitWorkflow::Logging.logger
end

#logger=(logger) ⇒ Object



52
53
54
# File 'lib/git_workflow/logging.rb', line 52

def logger=(logger)
  @logger = logger
end