artanis
artanis copied to clipboard
Logging
Added some abilities to Artanis with Sample file included.
Why didn't you use the stdlib logger?
Didn't know about it i will change it!
Crystal already provides a log handler that can be used: https://github.com/crystal-lang/crystal/blob/master/src/http/server/handlers/log_handler.cr
Ok so you all actually have todo is Add a handler to the HTTP Server and give it an IO location i.e STDOUT or File.open.
Interesting ! I made my logging.cr use the stdlib logger looks like i don't really need it now.
Yes, something as simple as:
log_handler = HTTP::LogHandler.new(STDOUT)
HTTP::Server.new("::1", 9292, [log_handler]) { |ctx| MyApp.call(ctx) }.listen
I think that whatever can be implemented as a Handler should be one, so Artanis is kept minimal. That being said, having access to a logger instance (on demand) would be nice, so I just added that: 689495d3cbd6a85a48c5b04e0c8aa53c659d140a