1
0
Fork 0
mirror of https://github.com/puma/puma.git synced 2022-11-09 13:48:40 -05:00

Don't log requests by default. Fixes #852

This commit is contained in:
Evan Phoenix 2016-02-25 13:09:02 -08:00
parent 20e99d1c04
commit 03ed48ca90
4 changed files with 18 additions and 6 deletions

View file

@ -147,10 +147,14 @@ module Puma
c.prune_bundler
end
o.on "-q", "--quiet", "Quiet down the output" do
o.on "-q", "--quiet", "Do not log requests internally (default true)" do
c.quiet
end
o.on "-v", "--log-requests", "Log requests as they occur" do
c.log_requests
end
o.on "-R", "--restart-cmd CMD",
"The puma command to run during a hot restart",
"Default: inferred" do |cmd|

View file

@ -165,7 +165,7 @@ module Puma
{
:min_threads => 0,
:max_threads => 16,
:quiet => false,
:log_requests => false,
:debug => false,
:binds => ["tcp://#{DefaultTCPHost}:#{DefaultTCPPort}"],
:workers => 0,
@ -242,10 +242,10 @@ module Puma
require 'puma/tcp_logger'
logger = @options[:logger]
return TCPLogger.new(logger, found, @options[:quiet])
return TCPLogger.new(logger, found, @options[:log_requests])
end
if !@options[:quiet] and @options[:environment] == "development"
if @options[:log_requests]
logger = @options[:logger]
found = CommonLogger.new(found, logger)
end

View file

@ -160,8 +160,14 @@ module Puma
# Disable request logging.
#
def quiet
@options[:quiet] = true
def quiet(which=true)
@options[:log_requests] = !which
end
# Enable request logging
#
def log_requests(which=true)
@options[:log_requests] = which
end
# Show debugging info

View file

@ -13,6 +13,8 @@ module Rack
options = DEFAULT_OPTIONS.merge(options)
conf = ::Puma::Configuration.new do |c|
c.quiet
if options.delete(:Verbose)
app = Rack::CommonLogger.new(app, STDOUT)
end