Improve logging
This commit is contained in:
parent
43565636e6
commit
2af3e40510
1 changed files with 14 additions and 2 deletions
|
@ -65,10 +65,10 @@ module Diversipub
|
|||
|
||||
def webrick_options
|
||||
@webrick_options ||= {
|
||||
AccessLog: [],
|
||||
AccessLog: webrick_access_log,
|
||||
BindAddress: 'localhost',
|
||||
DocumentRoot: nil,
|
||||
Logger: Logger.new(File.open('/dev/null', 'w')),
|
||||
Logger: web_logger,
|
||||
Port: 8080,
|
||||
}.freeze
|
||||
end
|
||||
|
@ -80,5 +80,17 @@ module Diversipub
|
|||
def sinatra_app
|
||||
@sinatra_app ||= SinatraApp.new self
|
||||
end
|
||||
|
||||
def webrick_access_log
|
||||
@webrick_access_log ||= [
|
||||
[$stderr, WEBrick::AccessLog::COMMON_LOG_FORMAT],
|
||||
].freeze
|
||||
end
|
||||
|
||||
def web_logger
|
||||
@web_logger ||= Logger.new(stderr).tap do |web_logger|
|
||||
web_logger.level = Logger::INFO
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue