module AppArchetype::Logger

CLI Logging methods

Public Instance Methods

logger(out = STDOUT) click to toggle source

Creates logger for printing messages

Sets the formatter to output only the provided message to the specified IO

@param [IO] out - default: STDOUT

@return [::Logger]

# File lib/app_archetype/logger.rb, line 14
def logger(out = STDOUT)
  @logger ||= ::Logger.new(out)
  @logger.formatter = proc do |_sev, _time, _prog, msg|
    "#{msg}\n"
  end

  @logger
end
print_error(message) click to toggle source

Prints error to STDERR

For indicating fatal message to user

@param [String] message - message to be printed

print_message(message) click to toggle source

Prints command line message to STDOUT

For use when printing info messages for a user to STDOUT

@param [String] message - message to be printed

print_message_and_exit(message, exit_code = 1) click to toggle source

Prints a message and then exits with given status code

This will terminate the program with the given status code

@param [String] message - message to be printed @param [Integer] exit_code - exit status (default: 1)

print_warning(message) click to toggle source

Prints warning to STDOUT

For use when printing warn messages to STDOUT

@param [String] message - message to be printed