Module: Simple::Httpd::Server
Defined Under Namespace
Modules: NullLogger
Instance Method Summary collapse
Instance Method Details
#listen!(app, environment: "development", host: nil, port:) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/simple/httpd/server.rb', line 13 def listen!(app, environment: "development", host: nil, port:) expect! app != nil host ||= "127.0.0.1" URI("http://#{host}:#{port}") # validate host and port ::Simple::Httpd.logger.info "Starting httpd server on http://#{host}:#{port}/" app = ::Rack::Lint.new(app) if environment != "production" # re/AccessLog: the AccessLog setting points WEBrick's access logging to the # NullLogger object. # # Instead we'll use a combination of Rack::CommonLogger (see Simple::Httpd.app), # and sinatra's logger (see Simple::Httpd::BaseController). ::Rack::Server.start app: app, Host: host, Port: port, environment: environment, Logger: build_logger, AccessLog: [[NullLogger, ""]] end |