mirror of
				https://gitea.invidious.io/iv-org/shard-kemal.git
				synced 2024-08-15 00:53:36 +00:00 
			
		
		
		
	Revert back to File.write
This commit is contained in:
		
							parent
							
								
									485fed11af
								
							
						
					
					
						commit
						556247c4ad
					
				
					 2 changed files with 3 additions and 2 deletions
				
			
		|  | @ -19,6 +19,7 @@ describe "Logger" do | ||||||
|     logger.handler.should be_a File |     logger.handler.should be_a File | ||||||
|   end |   end | ||||||
| 
 | 
 | ||||||
|  |   #TODO: Check https://github.com/manastech/crystal/issues/1899 | ||||||
|   it "writes to a file in production" do |   it "writes to a file in production" do | ||||||
|     config = Kemal.config |     config = Kemal.config | ||||||
|     config.env = "production" |     config.env = "production" | ||||||
|  | @ -27,6 +28,6 @@ describe "Logger" do | ||||||
|     logger.call request |     logger.call request | ||||||
|     str = File.read("kemal.log") |     str = File.read("kemal.log") | ||||||
|     File.delete("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 | ||||||
| end | end | ||||||
|  |  | ||||||
|  | @ -35,7 +35,7 @@ class Kemal::Logger < HTTP::Handler | ||||||
| 
 | 
 | ||||||
|   def write(message) |   def write(message) | ||||||
|     if @env == "production" |     if @env == "production" | ||||||
|       File.write "kemal.log", message |       @handler.write message.to_slice | ||||||
|     else |     else | ||||||
|       @handler.print message |       @handler.print message | ||||||
|     end |     end | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue