magiclogger - v0.1.0
    Preparing search index...

    Interface LogEntry

    MAGIC Schema v1 - Core log entry structure.

    This interface implements the MAGIC Schema specification for cross-language compatibility and seamless observability integration.

    interface LogEntry {
        context?: Record<string, unknown>;
        environment?: string;
        error?: {
            cause?: unknown;
            code?: string | number;
            message: string;
            name: string;
            stack?: string;
        };
        id: string;
        level: string;
        loggerId?: string;
        message: string;
        metadata?: {
            health?: { pid?: number; timestamp: number; uptime?: number };
            hostname?: string;
            nodeVersion?: string;
            pid?: number;
            platform?: string;
            resources?: {
                cpu?: { system: number; user: number };
                memory?: {
                    arrayBuffers: number;
                    external: number;
                    heapTotal: number;
                    heapUsed: number;
                    rss: number;
                };
            };
            trace?: {
                parentSpanId?: string;
                spanId?: string;
                traceFlags?: string;
                traceId?: string;
                traceState?: string;
            };
            userAgent?: string;
            [key: string]: unknown;
        };
        schemaVersion?: "v1";
        service?: string;
        styles?: [number, number, string][];
        tags?: string[];
        timestamp: number;
        trace?: {
            parentSpanId?: string;
            spanId?: string;
            traceFlags?: string;
            traceId?: string;
            traceState?: string;
        };
    }
    Index

    Properties

    context?: Record<string, unknown>

    User-provided structured context data. Can contain any application-specific data.

    environment?: string

    Deployment environment.

    "development" | "staging" | "production"
    
    error?: {
        cause?: unknown;
        code?: string | number;
        message: string;
        name: string;
        stack?: string;
    }

    Structured error information.

    id: string

    Unique identifier for this log entry. Format: "timestamp-randomComponent" (e.g., "1733938475123-abc123xyz")

    level: string

    Log level following syslog RFC5424 severity.

    loggerId?: string

    Logger instance identifier. Useful for multi-logger applications.

    message: string

    Plain text log message without any formatting codes. This is the primary message content for all transports.

    metadata?: {
        health?: { pid?: number; timestamp: number; uptime?: number };
        hostname?: string;
        nodeVersion?: string;
        pid?: number;
        platform?: string;
        resources?: {
            cpu?: { system: number; user: number };
            memory?: {
                arrayBuffers: number;
                external: number;
                heapTotal: number;
                heapUsed: number;
                rss: number;
            };
        };
        trace?: {
            parentSpanId?: string;
            spanId?: string;
            traceFlags?: string;
            traceId?: string;
            traceState?: string;
        };
        userAgent?: string;
        [key: string]: unknown;
    }

    Automatically collected runtime information.

    schemaVersion?: "v1"

    MAGIC schema version for compatibility.

    "v1"
    
    service?: string

    Service name for microservice architectures. Maps to service.name in OpenTelemetry.

    styles?: [number, number, string][]

    Optional style ranges for reconstructing formatted output. Each entry is [startIndex, endIndex, styleDescriptor]. Example: [[0, 6, "red.bold"], [12, 29, "cyan"]]

    tags?: string[]

    Categorization tags for filtering and routing.

    timestamp: number

    Unix timestamp in milliseconds for efficient sorting/filtering. Use toISOString() for human-readable display.

    trace?: {
        parentSpanId?: string;
        spanId?: string;
        traceFlags?: string;
        traceId?: string;
        traceState?: string;
    }

    Distributed tracing context. Follows OpenTelemetry trace context specification.