Security News
cURL Project and Go Security Teams Reject CVSS as Broken
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
@wiredcraft/bunyan-logger-factory
Advanced tools
From time to time, I found I have to create [Bunyan](https://www.npmjs.com/package/bunyan) instance with different streams(stdout/file/syslog) for different environments.
From time to time, I found I have to create Bunyan instance with different streams(stdout/file/syslog) for different environments.
const loggerFactory = require('bunyan-logger-factory');
const myLogger = loggerFactory.init({
logName: 'my-logger-name',
logStreams: [
{
streamType: process.env.LOGSTREAM,
streamHost: process.env.LOGHOST,
streamPort: process.env.LOGPORT,
streamProto: process.env.LOGPROTO,
}
],
});
You can also set the transformation to the logger.
const loggerFactory = require('bunyan-logger-factory');
const myLogger = loggerFactory.init({
logName: 'my-logger-name',
logStreams: [
{
streamType: process.env.LOGSTREAM,
streamHost: process.env.LOGHOST,
streamPort: process.env.LOGPORT,
streamProto: process.env.LOGPROTO,
}
],
transform: [
{
constant: {
ipsum: 'xxx',
},
},
],
});
This will add ipsum: xxx
to each log created.
const loggerFactory = require('bunyan-logger-factory');
const myLogger = loggerFactory.init({
logName: 'my-logger-name',
logStreams: [
{
streamType: process.env.LOGSTREAM,
streamHost: process.env.LOGHOST,
streamPort: process.env.LOGPORT,
streamProto: process.env.LOGPROTO,
}
],
transform: [
{
clone: {
msg: 'message',
time: 'timestamp',
},
},
],
});
This will generate two extra fields message
and timestamp
which have exact same value as msg
and `time**.
const loggerFactory = require('bunyan-logger-factory');
const fn = (v) => {return v + v;};
const myLogger = loggerFactory.init({
logName: 'my-logger-name',
logStreams: [
{
streamType: process.env.LOGSTREAM,
streamHost: process.env.LOGHOST,
streamPort: process.env.LOGPORT,
streamProto: process.env.LOGPROTO,
}
],
transform: [
{
map: {
foo: fn,
},
},
],
});
This will populate the value of foo by calling the fn
function.
By default, the logger.child will inherit the transformation you set on the parent if there is a tranform
in the init
function, you can set avoidChildTransform
to true to prevent that behavior.
const logger = loggerFactory.init({
logName: 'test-logger',
logStreams: [
{
streamType: 'FILE',
streamPath: filePath,
}
],
avoidChildTransform: true, // the transform only applies on the current logger instance.
transform: [
{
constant: {
ipsum: 'xxx',
},
},
],
});
It's possible to add multiple stream configs in logStreams
.
const logger = loggerFactory.init({
logName: 'multiStream',
logStreams: [
{
streamType: 'stdout'
},
{
streamType: 'syslog',
streamHost: 'localhost',
streamPort: 514,
streamProto: 'tcp'
}
]
});
MIT
FAQs
From time to time, I found I have to create [Bunyan](https://www.npmjs.com/package/bunyan) instance with different streams(stdout/file/syslog) for different environments.
The npm package @wiredcraft/bunyan-logger-factory receives a total of 6 weekly downloads. As such, @wiredcraft/bunyan-logger-factory popularity was classified as not popular.
We found that @wiredcraft/bunyan-logger-factory demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 24 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
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
Security News
Biden's executive order pushes for AI-driven cybersecurity, software supply chain transparency, and stronger protections for federal and open source systems.