Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
winston-cluster
Advanced tools
Winston transport for Node.js clustering.
Uses IPC to send log information from cluster workers to the master process for file based or other single threaded logging.
#!/usr/bin/env node
var cluster = require('cluster');
var winston = require('winston');
var winstonCluster = require('./lib/winston-cluster');
var logLevel = 'info';
if (cluster.isMaster) {
// Create parent thread logger
// Other transports (ie. file writing) should be bound to this
var logger = new winston.Logger({
transports: [
new winston.transports.Console({
level: logLevel,
}),
]
});
// Start child threads
var cpuCount = require('os').cpus().length;
for (var i = 0; i < cpuCount; i++) {
cluster.fork();
}
// Bind event listeners to child threads using the local logger instance
// has to be called after the child threads are started.
winstonCluster.bindListeners(logger);
// Logging works as normal in the main thread
logger.info("Started server!")
// Server thread logic here
// ...
} else {
// Create a new logger instance for the child thread using the cluster transport to
// send data back to the parent thread.
// Note that log level must also be set here to avoid filtering prior to sending logs back
var logger = winston.createLogger({transports: [
new winstonCluster({
level: logLevel,
}),
]})
// Logging in this instance now passed via IPC back to the parent
// (and tagged with the worker thread ID)
logger.info("Test Message!")
// Client thread logic here
// ...
}
See example-multi-logger.js
for an example on binding multiple logger instances.
FAQs
Winston transport for clustered services
The npm package winston-cluster receives a total of 69 weekly downloads. As such, winston-cluster popularity was classified as not popular.
We found that winston-cluster demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 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
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.