UNPKG

@athenna/logger

Version:

The Athenna logging solution. Log in stdout, files and buckets.

100 lines (99 loc) 2.52 kB
/** * @athenna/logger * * (c) João Lenon <lenon@athenna.io> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ import type { Context as OtelContext } from '@opentelemetry/api'; export declare abstract class Formatter { /** * Holds the configuration object of formatter. */ configs: any; /** * Creates a new instance of Formatter. */ config(configs: any): Formatter; /** * Format the message. */ abstract format(message: any): string; /** * Create the PID for formatter. */ pid(): string; /** * Create the hostname for formatter. */ hostname(): string; /** * Get the level without any color or format. */ level(): string; /** * Get the trace id for formatter. */ traceId(): string | null; /** * Get the span id for formatter. */ spanId(): string | null; /** * Resolve configured context bindings using the active OpenTelemetry context. */ contextBindings(activeContext?: OtelContext): Record<string, any>; /** * Create the timestamp for formatter. */ timestamp(): string; /** * Get the circular replacer function to be used in * JSON.stringify(). */ getCircularReplacer(): (key: any, value: any) => any; /** * Transform the message to string. */ toString(message: string): string; /** * Clean the message removing colors if clean * option is true. If force is true, then colors * will be removed even if configs clean option * is false. */ clean(message: string, force?: boolean): string; /** * Apply all colors necessary to message. */ applyColors(message: string): string; /** * Apply colors in message. */ applyColorsByChalk(message: string): string; /** * Apply colors in message by level. */ applyColorsByLevel(message: string): string; /** * Create the cli level string. */ cliLevel(): string; /** * Create the simple level string. */ simpleLevel(): string; /** * Create the message level emoji string. */ messageLevel(): string; /** * Get the emoji by level. */ getEmojiByLevel(level: string, customEmoji?: string): string; /** * Paint the message by level. */ paintMessageByLevel(level: string, message: string): string; }