Security News
Supply Chain Attack Detected in Solana's web3.js Library
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
node_log_json_on_fatal
Advanced tools
Output a JSON object when there is a fatal error for log watchers to catch
Node module that will log a JSON object to stderr
if the process is
crashing with a fatal error.
Prebuilt binaries are hosted in the Github release to simplify use. An alpine compatible version is included.
The package is setup with
node-pre-gyp
so if the
needed binary exists in the Github releases, it will downloaded. But if
does not exist, it will be compiled locally.
The default behavior for Node.js when encountering a fatal error is to print useful info to standard error and crash. But this data is unstructured, so if you are using a log monitoring service that expects JSON objects, it is not very helpful. This corrects that to get the basic data into JSON form so that it can be processed by log monitoring services.
npm install node_log_json_on_fatal
The module exports one function with the signature:
function setup(template, msgPath='message', locPath='location')
It can be used like:
const fatal = require('node_log_json_on_fatal');
const template = {
whatever: 'fields that need to be logged',
canBe: {
nested: true,
lists: [true, true],
},
details: {},
};
fatal.setup(template, 'details.message', 'details.location');
If the process crashes with a Node.js fatal error, the V8 supplied
message
and location
with be added to the template object at the
specified paths and the object will be logged as JSON.
NOTE: The module deep clones the template
, meaning later changes to it will
not be reflected in the output.
This uses node-gyp for building, so you'll need the normal C++ build
tools like make
and a compiler.
A basic build and test cycle can use invoked with:
npm run test
In this repo, Github actions are setup to build the binaries for the common operating systems when a Github release is created. So, the process for releasing a version is:
git fetch
git status
vi CHANGELOG.md
git add CHANGELOG.md
npm version -f -m "Release new version" <new-version>
git push && git push --tags
npm publish
FAQs
Output a JSON object when there is a fatal error for log watchers to catch
The npm package node_log_json_on_fatal receives a total of 0 weekly downloads. As such, node_log_json_on_fatal popularity was classified as not popular.
We found that node_log_json_on_fatal demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.