I think that it would be good to let the components of a server share a common logging tool/manager to make logging unified and consistent. Writing everything to stdout and piping it somewhere works, but it's not always desired. Adding a logging tool would also make it easy to customize error messages to, for example, automatically include a time stamp or other meta data.
One way of implementing this is to have a Logger trait with all the desired logging methods (error(...), warning(...), note(...)) and let different types implement it, similar to the Router trait. The server instance would keep an item with this trait and let the plugins, handlers and cache use it for logging.
I think that it would be good to let the components of a server share a common logging tool/manager to make logging unified and consistent. Writing everything to stdout and piping it somewhere works, but it's not always desired. Adding a logging tool would also make it easy to customize error messages to, for example, automatically include a time stamp or other meta data.
One way of implementing this is to have a
Logger
trait with all the desired logging methods (error(...)
,warning(...)
,note(...)
) and let different types implement it, similar to theRouter
trait. The server instance would keep an item with this trait and let the plugins, handlers and cache use it for logging.The discussion is moved to #12.