Handle cases when logger can be nil

This commit is contained in:
Sdogruyol 2016-01-18 17:25:52 +02:00
parent 8bac0a8aef
commit 788c7241d4
5 changed files with 5 additions and 6 deletions

View file

@ -16,8 +16,10 @@ at_exit do
server.ssl = config.ssl
Signal::INT.trap {
config.logger.write "Kemal is going to take a rest!\n"
config.logger.handler.close
if config.logging
config.logger.write "Kemal is going to take a rest!\n"
config.logger.handler.close
end
server.close
exit
}

View file

@ -39,7 +39,7 @@ end
# development: STDOUT in
# production: kemal.log
macro log(message)
Kemal::Logger::INSTANCE.write "#{{{message}}}\n"
Kemal::Logger::INSTANCE.write "#{{{message}}}\n" if Kemal.config.logging
end
# Enables / Disables logging

View file

@ -1,6 +1,5 @@
module Kemal::Middleware
class SSL
getter context
def initialize

View file

@ -71,5 +71,4 @@ class Kemal::ParamParser
@params[key] ||= value
end
end
end

View file

@ -42,5 +42,4 @@ class Kemal::Route
end
Regex.new "^#{pattern}/?$"
end
end