thomasp85 / fiery

A flexible and lightweight web server
https://fiery.data-imaginist.com
Other
240 stars 12 forks source link

infrastructure for event logging #18

Closed thomasp85 closed 6 years ago

thomasp85 commented 6 years ago

Need to come up with a flexible API for handling of logging.

Current idea: Fire gets a log(event, message) method and all internals will call it. The log method will dispatch the logging to a user defined logger which can write to a db, output to console, etc. If none exists it will be a zero-operation...

thomasp85 commented 6 years ago

@cpsievert can you comment on whether this will suit your requirements?

cpsievert commented 6 years ago

Sounds good, but depends on what's in the event/message...right now I'm just logging information about requests like this (this is the default for Flask):

server$on("after-request", function(server, id, request, ...) {
          msg <- sprintf(
            '%s - - [%s]  "%s %s HTTP/1.1" %s',
            request$host, Sys.time(), request$method,
            request$path, request$response$status
          )
          cat(msg, "\n")
})
thomasp85 commented 6 years ago

Hi @cpsievert - can you check out what I got brewing in #19 and see if there is any shortcomings or additional needs you can think of...