Security News
GitHub Removes Malicious Pull Requests Targeting Open Source Repositories
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
pino-caller
Advanced tools
print the filename and line number of the caller (use only in development environment)
pino-caller
is a wrapper for pino which adds the call site of each log message to the log output.
This can be useful when developing with large codebases in order to locate the exact point where pino is invoked.
For Pino v4 and below use the v2 line, which can be installed with the @legacy
tag:
npm install pino-caller@legacy
For Pino v5 and above use the v3+ line, which will install using the usual command:
npm install pino-caller
WARNING: THIS IS A DEVELOPMENT TOOL AVOID PRODUCTION USE!
'use strict'
const pino = require('pino')() // it will print as usual
const pinoCaller = require('pino-caller')(pino) // it will print also the calling site
pinoCaller.info('info1')
pinoCaller.error('error1')
pinoCaller.debug('debug1')
'use strict'
// dynamically load the plugin if in development environment, output paths relative to __dirname
const pino = process.env.NODE_ENV === 'development' ? require('pino-caller')(require('pino')(), { relativeTo: __dirname }) : require('pino')()
pino.info('info1')
pino.error('error1')
pino.debug('debug1')
You can find also a working example in the examples
directory and you can run it with npm run example
'use strict'
const pino = require('pino')()
const pinoCaller = require('pino-caller')(pino, { relativeTo: __dirname, stackAdjustment: 1 })
// People who have wrapped pino like in the contrived example below
// will want to use stackAdjustment.
// Most people will NOT need this. See issue #90 for details.
const log = {
info: function(message) { pinoCaller.info(message) }
}
╭─phra at debian in /home/phra/git/pino-caller (master ✔)
╰─λ npm run example
> pino-caller@1.0.0 example /home/phra/git/pino-caller
> env NODE_ENV=development node examples/index.js
{"pid":44837,"hostname":"debian","level":30,"time":1487873713227,"msg":"hello from the module!","caller":"Object.<anonymous> (/home/phra/git/pino-caller/examples/module.js:4:12)","v":1}
{"pid":44837,"hostname":"debian","level":30,"time":1487873713230,"msg":"info1","caller":"Object.<anonymous> (index.js:8:12)","v":1}
{"pid":44837,"hostname":"debian","level":50,"time":1487873713230,"msg":"error1","caller":"Object.<anonymous> (index.js:9:12)","v":1}
FAQs
print the filename and line number of the caller (use only in development environment)
The npm package pino-caller receives a total of 9,125 weekly downloads. As such, pino-caller popularity was classified as popular.
We found that pino-caller demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 5 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
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.