import { Formatter, EVENT } from '@axiomhq/logging'; export type ServerContextFields = Map | Record; export declare const storage: import('async_hooks').AsyncLocalStorage; /** * Formatter that adds context fields from the server context to log events. * * Regular fields are added to the `fields` property of the log event. * Properties under the EVENT symbol are added directly to the root of the log event. * * @example * // Using a Map * const contextMap = new Map(); * contextMap.set('userId', 123); * contextMap.set(EVENT, { traceId: 'abc123' }); * runWithServerContext(() => { * logger.info('Request processed'); * // Results in a log with fields.userId=123 and traceId at the root * }, contextMap); * * @example * // Using an object * const contextObj = { * userId: 123, * [EVENT]: { traceId: 'abc123' } * }; * runWithServerContext(() => { * logger.info('Request processed'); * // Results in a log with fields.userId=123 and traceId at the root * }, contextObj); * * @param logEvent - The log event to format * @returns The formatted log event with server context fields added */ export declare const serverContextFieldsFormatter: Formatter; /** * Runs a callback with the provided server context. * The context will be available to all loggers within the callback. * * @example * // Add regular fields and root-level properties to all logs in a request * import { EVENT } from '@axiomhq/logging'; * * runWithServerContext(() => { * // All logs within this callback will have userId in fields and traceId at the root * logger.info('Request started'); * processRequest(); * logger.info('Request completed'); * }, { * userId: 123, * requestPath: '/api/users', * [EVENT]: { * traceId: 'abc123', * requestId: 'req-456' * } * }); * * @param callback - The function to run with the server context * @param store - The context to use, can be a Map or an object with optional EVENT symbol * @returns The result of the callback */ export declare const runWithServerContext: (callback: () => any, store: ReturnType) => any;