lib/ruby_wolf/logger.rb in ruby_wolf-0.3.3 vs lib/ruby_wolf/logger.rb in ruby_wolf-0.4.0

- old
+ new

@@ -1,33 +1,41 @@ require 'logger' module RubyWolf class Logger < ::Logger - def info(contents = "") + def initialize(*args) + super(*args) + @formatter = proc do |severity, datetime, _progname, msg| + date_format = datetime.strftime('%Y-%m-%d %H:%M:%S') + "[#{severity.to_s[0]}] [#{date_format}] #{msg}\n" + end + end + + def info(contents = '') pre_process(contents) do |content| super(content) end end - def warn(contents = "") + def warn(contents = '') pre_process(contents) do |content| super(content) end end - def debug(contents = "") + def debug(contents = '') pre_process(contents) do |content| super(content) end end - def error(contents = "") + def error(contents = '') pre_process(contents) do |content| super(content) end end - def fatal(contents = "") + def fatal(contents = '') pre_process(contents) do |content| super(content) end end