class GitCommander::Logger

Handles logging for GitCommander

Constants

DEFAULT_LOG_FILE

Public Class Methods

new(*args) click to toggle source
Calls superclass method
# File lib/git_commander/logger.rb, line 10
def initialize(*args)
  log_file = args.shift || log_file_path
  args.unshift(log_file)
  super(*args)
  @formatter = SimpleFormatter.new
end

Private Instance Methods

log_file_path() click to toggle source
# File lib/git_commander/logger.rb, line 27
def log_file_path
  return @log_file_path unless @log_file_path.to_s.empty?

  # Here we have to run the command in isolation to avoid a recursive loop
  # to log this command run to fetch the config setting.
  configured_log_file_path = `git config --get commander.log-file-path`

  return @log_file_path = DEFAULT_LOG_FILE if configured_log_file_path.empty?

  @log_file_path = configured_log_file_path
end