-
-
Notifications
You must be signed in to change notification settings - Fork 1
Description
I like this logger and the fact that it does not provide writers, which gives me the liberty to create or choose writers.
Specifically, I would like to use this as I would use serilog in C#. Then I can create a writer that posts the data to a centralized location, like New Relic or Seq.
What is needed? I guess the concept of log properties, where each log entry carries a list of properties. Then a writer would have access to the collection of properties pertinent to the event. The sources of properties would be at least:
- The replaceable arguments in the logged message. For example, if I were to do
log.notice('%s returned status code %i.', '/api/login', res.status);, then the event should carry the values of the route and the status codes as properties. What would be the property names? I guess the message format would require an upgrade:log.notice('{route:%s} returned status code {statusCode:%i}.', '/api/login', res.status);. Now the text I put inside { } would become the property name. - Anything else, like an express middleware that collects data from the request or response object, thinking in terms of NodeJS being a web server, that is. For NodeJS projects that are not web servers, then maybe another way to add properties to events, or mechanisms that add properties to events automatically.
Anyway, if you want to know more, maybe check out Serilog's source code and documentation.
BTW, as a potential writer of log writers, I find the lack of documentation on how to do it a major problem. Will appreciate it if you could set up documentation for this.