Security News
Input Validation Vulnerabilities Dominate MITRE's 2024 CWE Top 25 List
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
@zenvia/zcc-logger
Advanced tools
A wrapper for Winston Logging node library that formats the output on STDOUT as Logstash JSON format.
A wrapper for Winston Logging node library that formats the output on STDOUT as Logstash JSON format.
npm install @zenvia/zcc-logger
The following environment variables can be used for increase the log information:
package.json
will be used instead.DEBUG
.true
, the output logging will not be formatted to JSON. Useful during development time. Default to false
.const logger = require('zcc-logger');
logger.info('some message');
Output:
{
"@timestamp": "2018-06-05T18:20:42.345Z",
"@version": 1,
"application": "application-name",
"message": "some message",
"level": "INFO"
}
The log levels are as follows.
For backward compatibility purposes, "verbose" and "silly" levels will behave the same as "debug" level.
logger.debug('Some text message', { keyA: 'value A', keyB: 'value B' });
Output:
{
"keyA": "value A",
"keyB": "value B",
"@timestamp": "2018-06-05T22:04:42.039Z",
"@version": 1,
"application": "application-name",
"message": "Some text message",
"level": "DEBUG"
}
logger.error('Ops!', new Error('Something goes wrong'));
Output:
{
"message": "Ops!: Something goes wrong",
"@timestamp": "2018-06-05T22:14:09.683Z",
"@version": 1,
"application": "application-name",
"level": "ERROR",
"stack_trace": "Error: Something goes wrong\n at repl:1:34\n at Script.runInThisContext (vm.js:91:20)\n at REPLServer.defaultEval (repl.js:317:29)\n at bound (domain.js:396:14)\n at REPLServer.runBound [as eval] (domain.js:409:12)\n at REPLServer.onLine (repl.js:615:10)\n at REPLServer.emit (events.js:187:15)\n at REPLServer.EventEmitter.emit (domain.js:442:20)\n at REPLServer.Interface._onLine (readline.js:290:10)\n at REPLServer.Interface._line (readline.js:638:8)"
}
Due to limitations of winston lib, when a text, an error and extra key/value fields are logged at once, the output message field will contain the text message, the error message and the full stack trace as shown.
logger.fatal('Ops!', new Error('Something goes wrong'), { keyA: 'value A', keyB: 'value B' });
Output:
{
"keyA": "value A",
"keyB": "value B",
"@timestamp": "2018-06-05T22:09:22.750Z",
"@version": 1,
"application": "application-name",
"message": "Ops! Error: Something goes wrong\n at repl:1:34\n at Script.runInThisContext (vm.js:91:20)\n at REPLServer.defaultEval (repl.js:317:29)\n at bound (domain.js:396:14)\n at REPLServer.runBound [as eval] (domain.js:409:12)\n at REPLServer.onLine (repl.js:615:10)\n at REPLServer.emit (events.js:187:15)\n at REPLServer.EventEmitter.emit (domain.js:442:20)\n at REPLServer.Interface._onLine (readline.js:290:10)\n at REPLServer.Interface._line (readline.js:638:8)",
"level": "FATAL"
}
FAQs
A wrapper for Winston Logging node library that formats the output on STDOUT as Logstash JSON format.
We found that @zenvia/zcc-logger demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 6 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.