lib/legion/logging/methods.rb in legion-logging-0.1.2 vs lib/legion/logging/methods.rb in legion-logging-0.1.3
- old
+ new
@@ -1,33 +1,39 @@
module Legion
module Logging
module Methods
- def debug(message, log = @log)
+ def debug(message = nil, log = @log)
+ message = yield if message.nil? && block_given?
message = Rainbow(message).blue if @color
log.debug(message)
end
- def info(message, log = @log)
+ def info(message = nil, log = @log)
+ message = yield if message.nil? && block_given?
message = Rainbow(message).green if @color
log.info(message)
end
- def warn(message, log = @log)
+ def warn(message = nil, log = @log)
+ message = yield if message.nil? && block_given?
message = Rainbow(message).yellow if @color
log.warn(message)
end
- def error(message, log = @log)
+ def error(message = nil, log = @log)
+ message = yield if message.nil? && block_given?
message = Rainbow(message).red if @color
log.error(message)
end
- def fatal(message, log = @log)
+ def fatal(message = nil, log = @log)
+ message = yield if message.nil? && block_given?
message = Rainbow(message).darkred if @color
log.fatal(message)
end
- def unknown(message, log = @log)
+ def unknown(message = nil, log = @log)
+ message = yield if message.nil? && block_given?
message = Rainbow(message).purple if @color
log.unknown(message)
end
end
end