Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
logging-utils
Advanced tools
Utilities for configuring simple log level based logging functionality on an object
Utilities for configuring simple log level based logging functionality on an object.
The log levels supported are the following:
Main module:
This module is exported as a Node.js module.
Using npm:
$ npm i --save logging-utils
// To use the logging utilties
const logging = require('logging-utils');
// Logging configuration functions
const configureLogging = logging.configureLogging;
const isLoggingConfigured = logging.isLoggingConfigured;
// Log level constants
const ERROR = logging.ERROR;
const WARN = logging.WARN;
const INFO = logging.INFO;
const DEBUG = logging.DEBUG;
const TRACE = logging.TRACE;
const context = { a: 1, b: 2, c: 3 }; // replace with your own target object to be configured
configureLogging(context);
configureLogging(context, WARN);
configureLogging(context, DEBUG, false, console, false, false);
configureLogging(context, DEBUG, false, console, false, true);
const log = configureLogging({});
// Log an error with a strack trace
context.error('Error message 1', new Error('Boom').stack);
// Log an error without a stack trace
context.error('Error message 2');
// Log a warning (or do nothing when warnings are disabled)
context.warn('Warning message 1');
// To avoid building the warning message (when warnings are disabled)
if (context.warnEnabled) context.warn('Warning message 2');
// Log an info message (or do nothing when info messages are disabled)
context.info('Info message 1');
// To avoid building the info message (when info messages are disabled)
if (context.infoEnabled) context.info('Info message 2');
// Log a debug message (or do nothing when debug messages are disabled)
context.debug('Debug message 1');
// To avoid building the debug message (when debug messages are disabled)
if (context.debugEnabled) context.debug('Debug message 2');
// To log a trace message (or do nothing when trace messages are disabled)
context.trace('Trace message 1');
// To avoid building the trace message (when trace messages are disabled)
if (context.traceEnabled) context.trace('Trace message 2');
This module's unit tests were developed with and must be run with tape. The unit tests have been tested on Node.js v4.3.2.
See the package source for more details.
FAQs
Utilities for configuring simple log level based logging functionality on an object
The npm package logging-utils receives a total of 48 weekly downloads. As such, logging-utils popularity was classified as not popular.
We found that logging-utils 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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.