Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
@ethersproject/logger
Advanced tools
@ethersproject/logger is a logging utility designed for use with the ethers.js library. It provides a simple and consistent way to log messages, warnings, and errors, making it easier to debug and track issues in your Ethereum-related applications.
Logging Messages
This feature allows you to log informational messages. The logger instance is created with a context name ('my-app' in this case), which helps in identifying the source of the log messages.
const { Logger } = require('@ethersproject/logger');
const logger = new Logger('my-app');
logger.info('This is an info message');
Logging Warnings
This feature allows you to log warning messages. Warnings are useful for indicating potential issues that are not necessarily errors but should be looked into.
const { Logger } = require('@ethersproject/logger');
const logger = new Logger('my-app');
logger.warn('This is a warning message');
Logging Errors
This feature allows you to log error messages. Errors indicate serious issues that need immediate attention.
const { Logger } = require('@ethersproject/logger');
const logger = new Logger('my-app');
logger.error('This is an error message');
Custom Error Codes
This feature allows you to create and throw custom errors with specific error codes. This is useful for categorizing and handling different types of errors in a more granular way.
const { Logger } = require('@ethersproject/logger');
const logger = new Logger('my-app');
const error = logger.makeError('Custom error message', 'CUSTOM_ERROR_CODE');
logger.throwError('This is a custom error', 'CUSTOM_ERROR_CODE', { additional: 'info' });
Winston is a versatile logging library for Node.js that supports multiple transports (e.g., console, file, HTTP). It is more feature-rich compared to @ethersproject/logger, offering advanced logging capabilities like log levels, custom formats, and more.
Bunyan is another logging library for Node.js that focuses on JSON logging. It provides a simple API for logging and supports features like log levels, serializers, and streams. Bunyan is more suited for applications that require structured logging.
Pino is a fast and low-overhead logging library for Node.js. It is designed for high-performance logging and supports features like log levels, serializers, and transports. Pino is ideal for applications where performance is a critical concern.
This sub-module is part of the ethers project.
It is responsible for managing logging and errors to maintain a standard structure.
For more information, see the documentation.
Most users will prefer to use the umbrella package, but for those with more specific needs, individual components can be imported.
const {
Logger,
// Enums
ErrorCode,
LogLevel,
} = require("@ethersproject/logger");
MIT License.
FAQs
Logger utility functions for ethers.
We found that @ethersproject/logger 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.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.