class Spark::Fire
Spark
logger functionality
Attributes
out[R]
returns the medium on where to print the error
verbose[R]
Public Class Methods
new(out: $stdout, verbose: false)
click to toggle source
Initialize with default stdout output and verbose false
# File lib/Spark/fire.rb, line 11 def initialize(out: $stdout, verbose: false) @out = out @verbose = verbose end
Public Instance Methods
error(message)
click to toggle source
Shows an error message
# File lib/Spark/fire.rb, line 36 def error(message) log.error(message.to_s.red) end
important(message)
click to toggle source
Show an important message in upper case
# File lib/Spark/fire.rb, line 41 def important(message) log.warn(message.to_s.upcase.magenta) end
info(message)
click to toggle source
Shows an info message
# File lib/Spark/fire.rb, line 56 def info(message) log.info(message.to_s.blue) end
log()
click to toggle source
Gets the logging object
# File lib/Spark/fire.rb, line 17 def log out.sync = true @log ||= Logger.new(out) @log.formatter = proc do |severity, datetime, progname, msg| if verbose string = "#{severity} [#{datetime.strftime('%Y-%m-%d %H:%M:%S.%2N')}]: " else string = "[#{datetime.strftime('%H:%M:%S')}]: " end string += "#{msg}\n" string end @log end
message(message)
click to toggle source
Shows a regular message
# File lib/Spark/fire.rb, line 61 def message(message) log.info(message.to_s) end
success(message)
click to toggle source
Shows a success message
# File lib/Spark/fire.rb, line 51 def success(message) log.info(message.to_s.green) end
warning(message)
click to toggle source
Shows a warning message
# File lib/Spark/fire.rb, line 46 def warning(message) log.warn(message.to_s.yellow) end