UNPKG

traceperf

Version:

High-performance function execution tracking and monitoring for Node.js

46 lines (45 loc) 1.32 kB
import { IFormatter, LogLevel, LogMeta } from '../types'; /** * JSON formatter for structured output * Formats log entries as JSON objects */ export declare class JsonFormatter implements IFormatter { /** * Format a log entry as JSON * * @param level - The log level * @param message - The log message * @param args - Additional arguments * @param meta - Metadata for the log entry * @returns The formatted log entry as a JSON string */ format(level: LogLevel, message: string | object, args: any[], meta: LogMeta): string; /** * Format a message for JSON output * * @param message - The message to format * @returns The formatted message */ private formatMessage; /** * Format arguments for JSON output * * @param args - The arguments to format * @returns The formatted arguments */ private formatArgs; /** * Sanitize an object for JSON serialization * * @param obj - The object to sanitize * @returns A sanitized version of the object */ private sanitizeObject; /** * Extract additional metadata from the log meta object * * @param meta - The log metadata * @returns Additional metadata as an object */ private extractExtraMeta; }