This appender allows adding tags to any call to the logger.
Documentation added:
Loggly Appender. Sends logging events to Loggly using node-loggly,
optionally setting tags.
This appender will scan the msg from the logging event, and pull out
any argument of the shape `{ tags: [] }` so that it's possible
to add tags in a normal logging call. If an object contains tags and
other members, that object is not used for loggly tagging.
For example:
logger.info({ tags: ['my-tag-1', 'my-tag-2'] }, 'Some message', someObj, ...)
And then this appender will remove the tags param and append it to the config.tags.
Allow V8 to optimize the logging functions by not leaking the arguments object
and reduce the number of object accesses in the toLevel function.
This results in a performance improvement of about 11%.
When logging an `Error` object using the clustered appender, the logged event is a JSON representation of the error, ex:
[2015-06-09 11:13:48.257] [ERROR] middleware.Security - { stack: 'Error: User is not authorized\n at Object.exec (D:\\Borealis\\demoux\\IMS\\server\\IMS\\middleware\\SecurityCheck\\Instance.js:41:14)\n [...] at applyArgs (D:\\Borealis\\demoux\\IMS\\server\\node_modules\\flow\\flow.js:9:15)\n at Function.flowState (D:\\Borealis\\demoux\\IMS\\server\\node_modules\\flow\\flow.js:39:6)\n at applyArgs (D:\\Borealis\\demoux\\IMS\\server\\node_modules\\flow\\flow.js:9:15)\n at Function.thisFlow.exec (D:\\Borealis\\demoux\\IMS\\server\\node_modules\\flow\\flow.js:94:4)\n at applyArgs (D:\\Borealis\\demoux\\IMS\\server\\node_modules\\flow\\flow.js:9:15)\n at thisFlow (D:\\Borealis\\demoux\\IMS\\server\\node_modules\\flow\\flow.js:15:4)\n at Object.exec (D:\\Borealis\\demoux\\IMS\\server\\node_modules\\flow\\flow.js:103:42)' }
The error should be formatted identically as with other appenders (e.g. only printing the stack).
This changes adds a check for a `stack` attribute on the serialized loggingEvent and unwraps the errors while deserializing it. Result is:
[2015-06-09 11:13:48.257] [ERROR] middleware.Security - Error: User is not authorized
at Object.exec (D:\Borealis\demoux\IMS\server\IMS\middleware\SecurityCheck\Instance.js:41:14)
at applyArgs (D:\Borealis\demoux\IMS\server\node_modules\flow\flow.js:9:15)
at Function.flowState (D:\Borealis\demoux\IMS\server\node_modules\flow\flow.js:39:6)
at applyArgs (D:\Borealis\demoux\IMS\server\node_modules\flow\flow.js:9:15)
at Function.thisFlow.exec (D:\Borealis\demoux\IMS\server\node_modules\flow\flow.js:94:4)
at applyArgs (D:\Borealis\demoux\IMS\server\node_modules\flow\flow.js:9:15)
at thisFlow (D:\Borealis\demoux\IMS\server\node_modules\flow\flow.js:15:4)
at Object.exec (D:\Borealis\demoux\IMS\server\node_modules\flow\flow.js:103:42)