Join GitHub today
makes formatting of log output to be configurable and plugable #9799
The initial motivation of this PR was to allow the datetime formatting to be changed in log output - by default, the logging outputs the time as the number of milliseconds since the app started, which is concise and great for browser apps, but for long running node apps it's very inconvenient because what you really need to know is an actual date/time so that log entries can be related to real human events (like an end-user's bug report). Changing the logging output (without this PR) is not possible because all appenders are baked in to use the static method
This PR changes the logging appenders so that they use an instance of the new
Also in this PR is a change to appenders - previously, every appender is uniquely identified by it's class name, but this prevents using the same class more than once; EG for node apps, it's quite reasonable to want to have a file-based appender, and to have multiple instances of a FileAppender, each one with a different set of filters and output filename.
This PR allows the appender to define a static
Because it's only the current appenders which are static -
This appenderName is useful if you have a proper object instance with a class derived from
IMHO the appenders need to be rewritten as a proper class, rather than this non-obvious kludge, but I want to keep that out of scope for now because there's quite a lot of code in the current appenders - plus it looks like there were some dependency issues that the original author was worried about.