import type { LoggerTransport, LoggerAdapterContext } from '@mastra/core/logger'; import { LogLevel, MastraLogger } from '@mastra/core/logger'; import pino from 'pino'; type TransportMap = Record; export type { LogLevel } from '@mastra/core/logger'; export interface PinoLoggerOptions { name?: string; level?: LogLevel; transports?: TransportMap; overrideDefaultTransports?: boolean; formatters?: pino.LoggerOptions['formatters']; redact?: pino.LoggerOptions['redact']; mixin?: pino.MixinFn; customLevels?: { [level in CustomLevels]: number; }; /** * When false, disables pino-pretty and outputs raw JSON. * Useful when sending logs to aggregators like Datadog, * Loki, or CloudWatch that expect single-line JSON per entry. * @default true */ prettyPrint?: boolean; /** * Override the key used for the log message. * Defaults to Pino's built-in 'msg' key. * Set to 'message' for compatibility with Google Cloud Logging, * Elastic Common Schema (ECS), Datadog, and AWS CloudWatch. * @example 'message' */ messageKey?: string; /** * Custom pino serializers, merged over Mastra's defaults. * By default the `error` key is serialized with pino's standard error * serializer (alongside pino's built-in `err`), so that * `logger.warn('...', { error })` records the message and stack rather * than an empty object. */ serializers?: pino.LoggerOptions['serializers']; } /** * Provides Pino-backed logging for Mastra applications. * * @example * ```typescript * import { Mastra } from '@mastra/core/mastra'; * import { PinoLogger } from '@mastra/loggers'; * * const mastra = new Mastra({ * logger: new PinoLogger({ name: 'my-app', level: 'info' }), * }); * ``` * * @see For documentation bundled with your installed package, locate * `@mastra/loggers/package.json` with your project's resolver or package-manager * tooling, then read `dist/docs/SKILL.md` from that package root and follow its * reference links. Use package-manager tools for virtual or archived packages. * * @see [Pino logger documentation](https://mastra.ai/reference/logging/pino-logger) * if packaged docs are unavailable. */ export declare class PinoLogger extends MastraLogger { #private; protected logger: pino.Logger; constructor(options?: PinoLoggerOptions); /** * Creates a child logger with additional bound context. * All logs from the child logger will include the bound context. * * @param bindings - Key-value pairs to include in all logs from this child logger * @returns A new PinoLogger instance with the bound context * * @example * ```typescript * const baseLogger = new PinoLogger({ name: 'MyApp' }); * * // Create module-scoped logger * const serviceLogger = baseLogger.child({ module: 'UserService' }); * serviceLogger.info('User created', { userId: '123' }); * // Output includes: { module: 'UserService', userId: '123', msg: 'User created' } * * // Create request-scoped logger * const requestLogger = baseLogger.child({ requestId: req.id }); * requestLogger.error('Request failed', { err: error }); * // Output includes: { requestId: 'abc', msg: 'Request failed', err: {...} } * ``` */ child(bindings: Record): PinoLogger; /** * Adapter hook (see `AdaptableLogger` in `@mastra/core/logger`): enables * native trace correlation (trace_id/span_id merged into the pino record * via mixin, for every destination) and observability export derived from * the same record. Called by Mastra during setup. */ __attachObservability(ctx: LoggerAdapterContext): void; /** * The adapter context lives on the ref cell shared by the whole * root/child family, so re-attach detection (multi-Mastra warning) must * key on that cell — attaching to a child re-targets the root too. */ __observabilityAttachmentKey(): object; debug(message: string, args?: Record): void; info(message: string, args?: Record): void; warn(message: string, args?: Record): void; error(message: string, args?: Record): void; trackException(error: Error, metadata?: Record): void; } //# sourceMappingURL=pino.d.ts.map