
Research
Security News
Malicious PyPI Package Exploits Deezer API for Coordinated Music Piracy
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
@flytio/flyt-logger
Advanced tools
Small logging library to be used in nodejs integrations.
A small logging library for use within flyt node integrations. Flyt Logger is a thin wrapper around the winston logger and can send logs over UDP or Console.
yarn add @flytio/flyt-logger
Create an instance of a logger using the factory constructor and then use it to get the logger instance. Preferably at the beginning of a request:
// main.ts
import { FlytLogger } from '@flytio/flyt-logger';
const logger = new FlytLogger();
Optionally you can pass requestId as a first parameter to the logger, and transport options as a second one.
You can use helper factory functions to do this. You can read more about options here
import {
createTransport,
FlytLogger,
TransportType
} from '@flytio/flyt-logger';
const logger = new FlytLogger('fsdh-4234-23jh', {
transports: [
createTransport(TransportType.File, fileOptions),
createTransport(TransportType.UDP, udpOptions),
createTransport(TransportType.Console, consoleOptions)
]
});
Once we have initialised we can use any of the logging methods available. Each logging method accepts a message and an optional metadata object if you wish to send any other data that you think appropriate.
// Info messages should be a simple meesage describing what is happening.
logger.info('sendCollectionOrder request started');
// Debug messages should have more context.
logger.debug(`pos response: ${JSON.stringify(responseFromPos)}`);
// Error messages should log out any errors that happen in your application.
logger.error(`order failed to send: ${JSON.stringify(error)}`);
Upgrading from winston 2 to winston 3 meant lot of changes in the logger creation and usage, especially how the metadata is passed to the log.
The transport interface that our UPD logger must compile changed from
public log(level: string, msg: string, meta: any = {}, callback: any): void;
to
public log?(info: any, next: () => void): any;
That means that all the metadata are now passed in the info object. Thankfully the backwards compatibility is ensured by winston logger here, but that comported changed in the way we're creating the logger and we're parsing the log messages in the UPD transport file:
//in flyt-logger.ts
const optionsWithFormat = {
...options,
format: winston.format.metadata(),
};
this.winston = winston.createLogger(optionsWithFormat);
log
method had then changed to work only with this specific format, defined by winston.format.metadata()
:
info: {
message: string,
metadata: {
requestId: string,
timestamp: string,
appLine: string
}
}
With the logger version 3.1.0 we started using the child logger functionality of winston (available since the v3.2.1). This allow us to re-use the same UDP connection to send multiple logs, instead of creating a new UDP connection for every log. That was a problem in high-volume traffic integrations because connections were left open after we've finished with the instance of the logger concerned with that request, making the integration crash intermittently when ran out of sockets.
You don't have to do anything in order to use the child loggers, just make sure you have installed flyt-logger version >= 3.1
FAQs
Small logging library to be used in nodejs integrations.
The npm package @flytio/flyt-logger receives a total of 0 weekly downloads. As such, @flytio/flyt-logger popularity was classified as not popular.
We found that @flytio/flyt-logger demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 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 uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.
Security News
Newly introduced telemetry in devenv 1.4 sparked a backlash over privacy concerns, leading to the removal of its AI-powered feature after strong community pushback.