lily
    Preparing search index...

    transport that writes log entries to a file with optional log rotation. supports automatic file rotation based on size and maintains a configurable number of backup files.

    const transport = new FileTransport({ filename: 'app.log' });
    logger.addTransport(transport);
    const transport = new FileTransport({
    filename: 'app.log',
    maxSize: 10 * 1024 * 1024, // 10mb
    maxFiles: 5 // keep 5 backup files
    });
    const transport = new FileTransport({
    filename: 'app.log',
    formatter: new ConsoleFormatter({ colourize: false })
    });

    Implements

    Index

    Constructors

    Methods

    Constructors

    Methods

    • writes a log entry to the file. automatically handles file rotation if maxSize is configured.

      Parameters

      Returns void

      const entry = {
      level: LogLevel.INFO,
      message: 'app started',
      timestamp: new Date(),
      scope: ['app'],
      args: []
      };
      transport.log(entry);