@vitaly-yosef/node-smart-logger
Version:
Universal logger for Node.js applications with support for both ESM and CommonJS. It provides advanced features, such as structured logging in JSON format, integration with AWS CloudWatch Logs, and contextual logging.
34 lines (33 loc) • 949 B
TypeScript
interface LoggerContext {
traceId?: string;
requestId?: string;
operationId?: string;
deviceId?: string;
userId?: string;
[key: string]: any;
}
/**
* Validates and sanitizes a string to prevent log injection
* @param input - String to sanitize
* @returns Sanitized string
*/
export declare function sanitizeForLogging(input: string): string;
/**
* Validates logger context data
* @param context - Context data to validate
* @returns Validated context data
*/
export declare function validateLoggerContext(context: Partial<LoggerContext>): LoggerContext;
/**
* Validates service name
* @param service - Service name to validate
* @returns Validated service name
*/
export declare function validateServiceName(service: string): string;
/**
* Validates log level
* @param level - Log level to validate
* @returns Validated log level
*/
export declare function validateLogLevel(level: string): string;
export {};