
Research
/Security News
Popular Go Decimal Library Targeted by Long-Running Typosquat with DNS Backdoor
A long-running Go typosquat impersonated the popular shopspring/decimal library and used DNS TXT records to execute commands.
@loglayer/plugin
Advanced tools
This is the base transport used for implementing transports for use with loglayer.
npm i loglayer @loglayer/transport
The shipToLogger method is the method that will be called by the loglayer to send the logs to the logger.
shipToLogger(params: LogLayerTransportParams): any[];
export interface LogLayerTransportParams {
/**
* The log level of the message
*/
logLevel: LogLevel;
/**
* The parameters that were passed to the log message method (eg: info / warn / debug / error)
*/
messages: any[];
/**
* Object data such as metadata, context, and / or error data
*/
data?: Record<string, any>;
/**
* If true, the data object is included in the message parameters
*/
hasData?: boolean;
}
// console-transport.ts
import type { LogLayerTransportParams } from "@loglayer/transport";
import { BaseTransport, LogLevel } from "@loglayer/transport";
type ConsoleType = typeof console;
export class ConsoleTransport extends BaseTransport<ConsoleType> {
shipToLogger({ logLevel, messages, data, hasData }: LogLayerTransportParams) {
if (data && hasData) {
// put object data as the first parameter
messages.unshift(data);
}
switch (logLevel) {
// this.logger is the instance of the logger passed in the constructor
case LogLevel.info:
// @ts-ignore
this.logger.info(...messages);
break;
case LogLevel.warn:
// @ts-ignore
this.logger.warn(...messages);
break;
case LogLevel.error:
// @ts-ignore
this.logger.error(...messages);
break;
case LogLevel.trace:
// @ts-ignore
this.logger.trace(...messages);
break;
case LogLevel.debug:
// @ts-ignore
this.logger.debug(...messages);
break;
case LogLevel.fatal:
// @ts-ignore
this.logger.error(...messages);
break;
}
return messages;
}
}
import { LogLayer } from 'loglayer'
import { ConsoleTransport } from "./console-transport.ts";
const logger = new LogLayer({
transport: new ConsoleTransport({
logger: console,
}),
})
class BaseTransport<LogLibrary extends LoggerLibrary> {
constructor(config: LogLayerTransportConfig<LogLibrary>);
/**
* Sends the log data to the logger for transport
*/
shipToLogger(params: LogLayerTransportParams): any[];
}
/**
* Logging methods that are common to logging libraries
*/
export interface LoggerLibrary {
info(...data: any[]): void;
warn(...data: any[]): void;
error(...data: any[]): void;
trace?: (...data: any[]) => void;
debug(...data: any[]): void;
fatal?: (...data: any[]) => void;
}
export interface LogLayerTransportConfig<LogLibrary> {
/**
* A user-defined identifier for the transport
*/
id: string;
/**
* The logging library instance to use for logging
*/
logger: LogLibrary;
/**
* If false, the transport will not send logs to the logger.
* Default is true.
*/
enabled?: boolean;
/**
* If true, the transport will log to the console for debugging purposes
*/
consoleDebug?: boolean;
}
FAQs
Base plugin used to implement plugins for loglayer.
The npm package @loglayer/plugin receives a total of 72,294 weekly downloads. As such, @loglayer/plugin popularity was classified as popular.
We found that @loglayer/plugin demonstrated a healthy version release cadence and project activity because the last version was released less than 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
A long-running Go typosquat impersonated the popular shopspring/decimal library and used DNS TXT records to execute commands.

Research
Active npm supply chain attack compromises @antv packages in a fast-moving malicious publish wave tied to Mini Shai-Hulud.

Security News
/Research
Socket detected malicious node-ipc versions with obfuscated stealer/backdoor behavior in a developing npm supply chain attack.