
Research
/Security News
Weaponizing Discord for Command and Control Across npm, PyPI, and RubyGems.org
Socket researchers uncover how threat actors weaponize Discord across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.
@ssense/node-logger
Advanced tools
SSENSE Standardized Logs
// Inclusion
import {Logger, LogLevel} from '@ssense/node-logger';
// Usage
const logger = new AppLogger('your_app_id', LogLevel.Silly);
// Enable / Disable
logger.enable(true);
// Set log level
logger.setLevel('Silly');
// Prettify / Indent
logger.setPretty(true);
// Log
// silly(message: string, id?: string, tags?: string[], details?: any)
// verbose(message: string, id?: string, tags?: string[], details?: any)
// info(message: string, id?: string, tags?: string[], details?: any)
// warn(message: string, id?: string, tags?: string[], details?: any)
// error(message: string, id?: string, tags?: string[], details?: any)
logger.silly('Some log message');
logger.error(`Error with paypal express checkout: ${orderId}`, 'MY_REQUEST_ID', ['checkout', 'paypal'], error.stack);
req.logger = logger.getRequestLogger('MY_REQUEST_ID');
req.logger.error(`Error with paypal express checkout: ${orderId}`, ['checkout', 'paypal'], error.stack);
import {AccessLogger} from '@ssense/node-logger';
const accessLogger = new AccessLogger('your_app_id');
// Enable / Disable
accessLogger.enable(true);
// Prettify / Indent
accessLogger.setPretty(process.env.NODE_ENV === 'development');
// Log
// logRequest(req: Request, res: Response)
accessLogger.logRequest(req, res);
If your application manipulates users, you may want to log the connected user id associated to each request.
This is possible with the AccessLogger setUserIdCallback
method.
This method allows you to pass a callback that will be called after each request, this callback takes in parameters the Request
and Response
objects.
To store the corresponding user id, just be sure to return a string when this callback is called.
Example:
const accessLogger = new AccessLogger('your_app_id');
accessLogger.setUserIdCallback((req, res) => {
return req.header('customer-id');
});
In this case, if a request has a customer-id
header, it will be logged as userId
field by the AccessLogger.
FAQs
Application and access logger
We found that @ssense/node-logger demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 10 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.
Research
/Security News
Socket researchers uncover how threat actors weaponize Discord across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.
Security News
Socket now integrates with Bun 1.3’s Security Scanner API to block risky packages at install time and enforce your organization’s policies in local dev and CI.
Research
The Socket Threat Research Team is tracking weekly intrusions into the npm registry that follow a repeatable adversarial playbook used by North Korean state-sponsored actors.