lib/sequenceserver/logger.rb in sequenceserver-1.0.0.pre.2 vs lib/sequenceserver/logger.rb in sequenceserver-1.0.0.pre.3
- old
+ new
@@ -1,27 +1,25 @@
require 'logger'
module SequenceServer
-
+ # Extend stdlib's Logger class for custom initialization and log format.
class Logger < Logger
-
def initialize(dev, verbose = false)
super dev
self.level = verbose ? DEBUG : INFO
self.formatter = Formatter.new
end
# We change Logging format so that it is consistent with Sinatra's
class Formatter < Formatter
+ FORMAT = "[%s] %s %s\n"
- Format = "[%s] %s %s\n"
-
def initialize
- self.datetime_format = "%Y-%m-%d %H:%M:%S"
+ self.datetime_format = '%Y-%m-%d %H:%M:%S'
end
- def call(severity, time, progname, msg)
- Format % [format_datetime(time), severity, msg2str(msg)]
+ def call(severity, time, _progname, msg)
+ format FORMAT, format_datetime(time), severity, msg2str(msg)
end
end
end
end