
Research
Two Malicious Rust Crates Impersonate Popular Logger to Steal Wallet Keys
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
@smarterservices/smarter-logging
Advanced tools
Unified logging package for back end services that sends logs to BetterStack. This library provides a consistent logging interface across all services with support for different log levels, custom labels, and structured logging.
npm install @smarterservices/smarter-logging --save
The library requires BetterStack credentials to be set as environment variables:
BETTERSTACK_SOURCE_TOKEN=your_source_token
BETTERSTACK_HOST=your_betterstack_host
Before using any logging methods, you must initialize the logger with your application name:
const logging = require('@smarterservices/smarter-logging');
// Initialize with application name
logging.init('MyServiceName');
// Optionally add custom labels
logging.init('MyServiceName', {
API: 'API',
AUTH: 'Authentication',
DB: 'Database'
});
The library provides four logging levels:
// Error logging
logging.error('AUTH', 'Failed to authenticate user', errorObject);
// Info logging
logging.info('API', 'Request processed successfully', { requestId: '123', duration: 45 });
// Warning logging
logging.warn('DB', 'Database connection slow', { latency: 500 });
// Debug logging (only works in stage environment)
logging.debug('API', 'Processing request', { payload: req.body });
All logging methods accept the same parameters:
label
(string, optional): A category for the log. If not provided, defaults to 'Generic'.message
(string, required): The main log message.object
(any, optional): Additional data to include with the log. Can be an error object or any JSON-serializable data.You can define custom labels during initialization and use them throughout your application:
logging.init('MyServiceName', {
AUTH: 'Authentication',
PAYMENT: 'Payment Processing',
USER: 'User Management'
});
// Later in your code
logging.info('AUTH', 'User logged in successfully');
logging.error('PAYMENT', 'Payment failed', errorObject);
stage
environment to prevent cluttering production logs.[production]
, [stage]
, etc.) in the message.The library handles errors internally:
To run the tests:
npm test
For test coverage:
npm run test:coverage
When adding new features, make sure to:
tests
directorynpm run lint
This library maintains high test coverage (>94%) to ensure reliability. The coverage badge at the top of this README reflects the current branch coverage. You can generate a detailed coverage report by running:
npm run test:coverage
This will create a coverage report in the coverage
directory that you can view in your browser.
This package follows semantic versioning (SemVer). To release a new version:
Update the version in package.json
according to SemVer rules:
Commit the version change:
git add package.json
git commit -m "Bump version to x.y.z"
Create and push a new tag:
git tag vx.y.z
git push origin master --tags
The Bitbucket Pipeline will automatically:
Note: This package is published as a private NPM package, accessible only to authorized users within the organization.
The badges at the top of this README provide at-a-glance information about:
FAQs
Sends logs to BetterStack
We found that @smarterservices/smarter-logging demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 4 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
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
Research
A malicious package uses a QR code as steganography in an innovative technique.
Research
/Security News
Socket identified 80 fake candidates targeting engineering roles, including suspected North Korean operators, exposing the new reality of hiring as a security function.