magiclogger - v0.1.0
    Preparing search index...

    Interface SyncFileTransportOptions

    Configuration options for the synchronous file transport.

    SyncFileTransportOptions

    1.0.0

    interface SyncFileTransportOptions {
        bufferSize?: number;
        enabled?: boolean;
        filepath: string;
        flushInterval?: number;
        forceSync?: boolean;
        format?: "json" | "plain";
        formatter?: (entry: LogEntry) => string;
        highWaterMark?: number;
        level?: string;
        maxFiles?: number;
        maxFileSize?: number;
        name?: string;
        timestamp?: boolean;
    }
    Index

    Properties

    bufferSize?: number

    Number of log entries to buffer before writing. Higher values improve throughput but increase memory usage and risk of data loss.

    WARNING: Buffered logs can be lost if the process crashes!

    • bufferSize=1: Immediate write (safest, ~20k ops/sec)
    • bufferSize=100: Small buffer (balanced, ~40k ops/sec)
    • bufferSize=1000: Large buffer (fastest but risky, ~25k ops/sec)
    1000
    
    enabled?: boolean

    Whether the transport is enabled.

    true
    
    filepath: string

    Path to the log file. Directories will be created automatically if they don't exist.

    flushInterval?: number

    Interval in milliseconds between automatic flushes. Set to 0 to disable time-based flushing.

    100
    
    forceSync?: boolean

    Force fsync after each write for maximum durability. This guarantees logs are on disk but reduces performance to ~1000 ops/sec. Only use for critical audit logs.

    false
    
    format?: "json" | "plain"

    Output format for log entries.

    • 'json': NDJSON format (one JSON object per line)
    • 'plain': Human-readable plain text format
    'json'
    
    formatter?: (entry: LogEntry) => string

    Custom formatter for log entries.

    Type Declaration

      • (entry: LogEntry): string
      • Parameters

        Returns string

        Formatted string to write

    highWaterMark?: number

    Size of the kernel write buffer in bytes. Larger buffers reduce system calls and improve performance.

    65536 (64KB)
    
    level?: string

    Minimum log level to write.

    'debug'
    
    maxFiles?: number

    Maximum number of rotated files to keep.

    5
    
    maxFileSize?: number

    Maximum file size in bytes before rotation. Set to 0 to disable rotation.

    0
    
    name?: string

    Transport identifier.

    'sync-file'
    
    timestamp?: boolean

    Whether to append timestamp to filename.

    false