Security News
New Python Packaging Proposal Aims to Solve Phantom Dependency Problem with SBOMs
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.
bene-logger
Advanced tools
The BENE Logger is a library, which wraps winston
with default
parameters to be sent to all log messages using the instance.
It also provides the console.time
and console.timeEnd
functionality
to the logger, so that your log messages contain durations.
Additionally, it allows you to log to Elasticsearch directly.
The log levels follow the syslog
standard as laid out in RFC5424, and
are as follows:
{ emerg: 0, alert: 1, crit: 2, error: 3, warning: 4, notice: 5, info: 6, debug: 7 }
You can specify the logger to only log up to a certain log level, by
passing in level
to the options. For example to only log emerg
,
alert
, crit
, and error
logs, pass in level: 'error'
.
A simple log message is shown below:
var BeneLogger = require('bene-logger');
var logger = new BeneLogger({ defaults: { foo: 'bar' } });
logger.info('entering the void', { boo: 'moo' });
// info: entering the void boo=moo, foo=bar
Another example showing the usage of the setDefaults
method:
var BeneLogger = require('bene-logger');
var logger = new BeneLogger({ defaults: {alpha: 'bravo'}});
logger.setDefaults({charlie: 'delta'});
logger.info('calling phonetic alphabet');
// info: calling phonetic alphabet charlie=delta
Below is an example of a timed log message:
var BeneLogger = require('bene-logger');
var logger = new BeneLogger({ defaults: { process_id: 1337 } });
logger.time('db request');
// ... request here that takes 1234ms
logger.timeEnd('db request', { request_id: 42 });
// info: db request request_id=42, process_id=1337, duration=1234
An Elasticsearch example is shown below:
var BeneLogger = require('bene-logger');
var logger = new BeneLogger({
defaults: { foo: 'bar' },
elasticsearch: {
indexPrefix: 'logs',
indexSuffixPattern: 'YYYY.MM.DD',
clientOpts: { host: 'http://localhost:9200' }
}
});
logger.info('entering the void', { boo: 'moo' });
// info: entering the void boo=moo, foo=bar
For more options to pass into the elasticsearch
property,
refer here.
FAQs
Logger library for Chronos.
The npm package bene-logger receives a total of 5 weekly downloads. As such, bene-logger popularity was classified as not popular.
We found that bene-logger demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 7 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
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.
Security News
Socket CEO Feross Aboukhadijeh discusses open source security challenges, including zero-day attacks and supply chain risks, on the Cyber Security Council podcast.
Security News
Research
Socket researchers uncover how threat actors weaponize Out-of-Band Application Security Testing (OAST) techniques across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.