Use a custom, more compact, logger formatter

This commit is contained in:
Thibault Jouan 2015-04-16 21:36:01 +00:00
parent d6b23994e9
commit fbfc6089a3
3 changed files with 18 additions and 0 deletions

View File

@ -8,6 +8,7 @@ require 'uh/wm/cli'
require 'uh/wm/client' require 'uh/wm/client'
require 'uh/wm/dispatcher' require 'uh/wm/dispatcher'
require 'uh/wm/env' require 'uh/wm/env'
require 'uh/wm/logger_formatter'
require 'uh/wm/manager' require 'uh/wm/manager'
require 'uh/wm/run_control' require 'uh/wm/run_control'
require 'uh/wm/runner' require 'uh/wm/runner'

View File

@ -51,6 +51,7 @@ module Uh
o.level = debug? ? LOGGER_LEVEL_DEBUG : o.level = debug? ? LOGGER_LEVEL_DEBUG :
verbose? ? LOGGER_LEVEL_VERBOSE : verbose? ? LOGGER_LEVEL_VERBOSE :
LOGGER_LEVEL LOGGER_LEVEL
o.formatter = LoggerFormatter.new
end end
end end

View File

@ -0,0 +1,16 @@
module Uh
module WM
class LoggerFormatter
FORMAT_STR = "%s.%03i %s: %s\n".freeze
def call severity, datetime, progname, message
FORMAT_STR % [
datetime.strftime('%FT%T'),
datetime.usec / 1000,
severity[0..0],
message
]
end
end
end
end