magiclogger - v0.1.0
    Preparing search index...

    Interface FileTransportOptions

    Configuration options for async file transport.

    These options control the behavior of the async file transport, including buffering, file handling, and performance tuning.

    AsyncFileTransportOptions

    interface FileTransportOptions {
        append?: boolean;
        bufferSize?: number;
        enabled?: boolean;
        filepath: string;
        flushInterval?: number;
        forceSync?: boolean;
        format?: "json" | "plain";
        fsync?: boolean;
        level?: string;
        maxWrite?: number;
        minLength?: number;
        mkdir?: boolean;
        mode?: number;
        name?: string;
        retryEAGAIN?: boolean;
    }
    Index

    Properties

    append?: boolean

    Append to existing file.

    true
    
    bufferSize?: number

    Use minLength instead

    enabled?: boolean

    Whether transport is enabled.

    true
    
    filepath: string

    File path for logs. Required.

    '/var/log/app.log'
    
    flushInterval?: number

    Use minLength instead

    forceSync?: boolean

    Use fsync instead

    format?: "json" | "plain"

    Output format for log entries.

    • 'json': NDJSON format (one JSON object per line)
    • 'plain': Human-readable plain text format
    'json'
    
    fsync?: boolean

    Force synchronous writes with fsync. Warning: Enabling this significantly reduces performance.

    false
    
    level?: string

    Minimum log level to process.

    'debug'
    
    maxWrite?: number

    Maximum bytes to write in a single operation. Controls the chunk size for each write system call.

    Should be larger than minLength to allow efficient batching. Typical values: 16KB-64KB depending on system I/O characteristics.

    16384 (16KB)
    
    minLength?: number

    Minimum buffer length before auto-flush (minLength in sonic-boom). Controls when the buffer is automatically flushed to disk.

    Performance considerations:

    • Smaller values (1-4KB): Lower latency, more frequent writes
    • Medium values (4-16KB): Balanced performance (recommended)
    • Larger values (16-64KB): Higher throughput, higher memory usage
    4096 (4KB)
    
    mkdir?: boolean

    Create directory if it doesn't exist.

    true
    
    mode?: number

    File mode for new files.

    0o666
    
    name?: string

    Transport name for identification.

    'async-file'
    
    retryEAGAIN?: boolean

    Retry on EAGAIN errors.

    true