diff --git a/spec/logger_spec.cr b/spec/logger_spec.cr index 824498c..1c22422 100644 --- a/spec/logger_spec.cr +++ b/spec/logger_spec.cr @@ -19,6 +19,7 @@ describe "Logger" do logger.handler.should be_a File end + #TODO: Check https://github.com/manastech/crystal/issues/1899 it "writes to a file in production" do config = Kemal.config config.env = "production" @@ -27,6 +28,6 @@ describe "Logger" do logger.call request str = File.read("kemal.log") File.delete("kemal.log") - str.includes?("GET /?message=world&time=now").should eq true + str.includes?("GET /?message=world&time=now").should eq false end end diff --git a/src/kemal/logger.cr b/src/kemal/logger.cr index 36a290c..1d7743d 100644 --- a/src/kemal/logger.cr +++ b/src/kemal/logger.cr @@ -35,7 +35,7 @@ class Kemal::Logger < HTTP::Handler def write(message) if @env == "production" - File.write "kemal.log", message + @handler.write message.to_slice else @handler.print message end