magiclogger - v0.1.0
    Preparing search index...

    Interface MongoDBTransportOptions

    MongoDB transport options.

    interface MongoDBTransportOptions {
        circuitBreaker?: {
            enabled: boolean;
            errorThreshold?: number;
            resetTimeout?: number;
        };
        clientOptions?: Record<string, unknown>;
        collection?: string;
        compress?: boolean;
        connectionTimeout?: number;
        createIndexes?: boolean;
        database?: string;
        dlq?: {
            enabled: boolean;
            filepath?: string;
            maxAge?: number;
            maxSize?: number;
        };
        enabled?: boolean;
        excludeTags?: string[];
        fallback?: string
        | Transport;
        filter?: (entry: LogEntry) => boolean;
        format?: "json" | "plain" | "custom";
        formatter?: (entry: LogEntry) => string | Buffer<ArrayBufferLike>;
        headers?: Record<string, string>;
        healthCheckInterval?: number;
        immediate?: boolean;
        keepAliveInterval?: number;
        level?: string;
        levels?: string[];
        maxBatchBytes?: number;
        maxBatchSize?: number;
        maxBatchTime?: number;
        maxOfflineQueueSize?: number;
        maxQueueSize?: number;
        maxReconnectAttempts?: number;
        maxRetries?: number;
        name?: string;
        queueWhenOffline?: boolean;
        reconnectBackoff?: boolean;
        reconnectDelay?: number;
        requestTimeout?: number;
        retry?: RetryOptions;
        retryDelay?: number;
        retryOnFailure?: boolean;
        silent?: boolean;
        tags?: string[];
        timeout?: number;
        tls?: {
            ca?: string;
            cert?: string;
            key?: string;
            rejectUnauthorized?: boolean;
        };
        transformDocument?: (entry: LogEntry) => Record<string, unknown>;
        ttl?: number;
        uri: string;
        url?: string;
    }

    Hierarchy (View Summary)

    Index

    Properties

    circuitBreaker?: {
        enabled: boolean;
        errorThreshold?: number;
        resetTimeout?: number;
    }

    Circuit breaker configuration.

    clientOptions?: Record<string, unknown>

    MongoDB client options.

    collection?: string

    Collection name.

    'entries'
    
    compress?: boolean

    Compress batches before sending (gzip).

    false
    
    connectionTimeout?: number

    Connection timeout in milliseconds.

    createIndexes?: boolean

    Whether to create indexes for common queries.

    true
    
    database?: string

    Database name.

    'logs'
    
    dlq?: { enabled: boolean; filepath?: string; maxAge?: number; maxSize?: number }

    Dead letter queue configuration for failed logs.

    enabled?: boolean

    Whether this transport is currently active. Allows runtime enabling/disabling of transports.

    true
    
    excludeTags?: string[]

    Tags that exclude logs from this transport. Logs with any of these tags are skipped.

    fallback?: string | Transport

    Fallback transport to use when this transport fails. Can be 'file', 'console', or a Transport instance.

    filter?: (entry: LogEntry) => boolean

    Custom filter function for advanced filtering logic. Return true to process the log, false to skip.

    format?: "json" | "plain" | "custom"

    Output format for this transport.

    'json'
    
    formatter?: (entry: LogEntry) => string | Buffer<ArrayBufferLike>

    Custom formatter function. Used when format is 'custom'.

    headers?: Record<string, string>

    Request headers to include with all requests.

    healthCheckInterval?: number

    Health check interval in milliseconds.

    immediate?: boolean

    Whether to send logs immediately without batching. Overrides other batch settings when true.

    false
    
    keepAliveInterval?: number

    Keep-alive interval in milliseconds.

    level?: string

    Minimum log level this transport will handle. Logs below this level are ignored by this transport.

    'info'
    
    levels?: string[]

    Custom levels this transport should handle. Allows fine-grained control over what gets logged where.

    maxBatchBytes?: number

    Maximum size in bytes before sending a batch.

    1048576 (1MB)
    
    maxBatchSize?: number

    Maximum number of logs to batch before sending.

    100
    
    maxBatchTime?: number

    Maximum time to wait before sending a batch (milliseconds).

    5000 (5 seconds)
    
    maxOfflineQueueSize?: number

    Maximum offline queue size.

    maxQueueSize?: number

    Maximum queue size.

    10000
    
    maxReconnectAttempts?: number

    Maximum reconnection attempts.

    maxRetries?: number

    Maximum retry attempts for failed batches.

    3
    
    name?: string

    Unique name identifier for this transport instance. Used for managing multiple transports.

    queueWhenOffline?: boolean

    Whether to queue logs when offline.

    reconnectBackoff?: boolean

    Whether to use exponential backoff for reconnects.

    reconnectDelay?: number

    Delay between reconnection attempts.

    requestTimeout?: number

    Request timeout in milliseconds.

    retry?: RetryOptions

    Retry configuration for failed requests.

    retryDelay?: number

    Initial retry delay in milliseconds.

    1000
    
    retryOnFailure?: boolean

    Whether to retry on failure.

    true
    
    silent?: boolean

    Whether to handle errors silently or propagate them.

    true
    
    tags?: string[]

    Tags that must be present for this transport to handle a log. If specified, only logs with at least one matching tag are processed.

    timeout?: number

    Timeout for transport operations in milliseconds.

    30000 (30 seconds)
    
    tls?: { ca?: string; cert?: string; key?: string; rejectUnauthorized?: boolean }

    TLS/SSL options for HTTPS connections.

    transformDocument?: (entry: LogEntry) => Record<string, unknown>

    Custom document transformer before insertion.

    ttl?: number

    TTL (time to live) for log entries in seconds. Automatically deletes old logs.

    uri: string

    MongoDB connection string.

    url?: string

    Network endpoint URL.