install(logger: Logger,options?: WinstonSinkOptions,): void
Automatically configures LogTape to route all logs to a winston logger.
This is a convenience function that automatically sets up LogTape to forward all log records to a winston logger instance. By default, it uses winston's default logger, but you can provide a custom logger as the first parameter.
Basic auto-configuration with default logger
Basic auto-configuration with default logger
import { install } from "@logtape/adaptor-winston"; // Automatically route all LogTape logs to winston's default logger install(); // Now any LogTape-enabled library will log through winston import { getLogger } from "@logtape/logtape"; const logger = getLogger("my-app"); logger.info("This will be logged through winston");
Auto-configuration with custom winston logger
Auto-configuration with custom winston logger
import winston from "winston"; import { install } from "@logtape/adaptor-winston"; const customLogger = winston.createLogger({ level: "info", format: winston.format.combine( winston.format.timestamp(), winston.format.json() ), transports: [ new winston.transports.Console(), new winston.transports.File({ filename: "app.log" }) ] }); // Install with custom logger install(customLogger);
logger: Logger
The winston logger instance to use.
options: WinstonSinkOptions
Configuration options for the winston sink behavior.
install(options?: WinstonSinkOptions): void
Configures LogTape to route all logs to winston's default logger.
options: WinstonSinkOptions
Optional configuration for the winston sink behavior.