import { Duplex, Writable } from "stream"; import { Context, ILogLevel, ILogtailLog, ILogtailNodeOptions, LogLevel, StackContextHint } from "@logtail/types"; import { Base } from "@logtail/core"; export declare class Node extends Base { /** * Readable/Duplex stream where JSON stringified logs of type `ILogtailLog` * will be pushed after syncing */ private _writeStream?; constructor(sourceToken: string, options?: Partial); /** * Override `Base` log to enable Node.js streaming * * @param message: string - Log message * @param level (LogLevel) - Level to log at (debug|info|warn|error) * @param context: (Context) - Log context for passing structured data * @param stackContextHint: (StackContextHint|null) - Info about which methods to consider as origin in context.runtime * @returns Promise after syncing */ log(message: string, level?: ILogLevel, context?: TContext, stackContextHint?: StackContextHint): Promise; /** * Flush batched logs to Better Stack, and wait for batches already being sent (started by `batchInterval` or * `batchSize`), so that everything logged before the call has been sent when it resolves */ flush(): Promise; /** * Override `Base` to attribute forwarded console calls to their caller instead of the console replacement */ protected _logFromConsole(message: string, level: LogLevel, context: Context): Promise; /** * Pipe JSON stringified `ILogtailLog` to a stream after syncing * * @param stream - Writable|Duplex stream */ pipe(stream: Writable | Duplex): Writable | Duplex; private encodeAsMsgpack; private createAgent; private getHttpModule; }