@mastra/loggers 1.3.10-alpha.0 → 1.3.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/docs/references/docs-observability-logging.md +3 -0
- package/dist/docs/references/reference-core-mastra-class.md +7 -5
- package/dist/docs/references/reference-logging-pino-logger.md +1 -1
- package/dist/file/index.cjs +2 -3
- package/dist/file/index.js +2 -3
- package/dist/http/index.cjs +1 -2
- package/dist/http/index.js +1 -2
- package/dist/index.cjs +2 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -2
- package/dist/{pagination-BfSC4BZ-.js → pagination-B6HKeXNa.js} +2 -3
- package/dist/{pagination-BfSC4BZ-.js.map → pagination-B6HKeXNa.js.map} +1 -1
- package/dist/{pagination-D4VAcPxN.cjs → pagination-BwV-2IW0.cjs} +2 -3
- package/dist/{pagination-D4VAcPxN.cjs.map → pagination-BwV-2IW0.cjs.map} +1 -1
- package/dist/upstash/index.cjs +2 -3
- package/dist/upstash/index.js +2 -3
- package/package.json +10 -10
package/dist/docs/SKILL.md
CHANGED
|
@@ -41,6 +41,9 @@ When a log call happens inside a traced operation (an agent run, workflow step,
|
|
|
41
41
|
To get machine-parseable JSON on stdout, configure `PinoLogger` with `prettyPrint: false`, pretty printing is enabled by default and produces human-readable text instead of JSON:
|
|
42
42
|
|
|
43
43
|
```typescript
|
|
44
|
+
import { Mastra } from '@mastra/core/mastra'
|
|
45
|
+
import { PinoLogger } from '@mastra/loggers'
|
|
46
|
+
|
|
44
47
|
export const mastra = new Mastra({
|
|
45
48
|
logger: new PinoLogger({ name: 'Mastra', level: 'info', prettyPrint: false }),
|
|
46
49
|
})
|
|
@@ -34,6 +34,8 @@ export const mastra = new Mastra({
|
|
|
34
34
|
Enable scheduled notification dispatch when deferred notification records and notification summaries should be delivered automatically through the workflow scheduler:
|
|
35
35
|
|
|
36
36
|
```typescript
|
|
37
|
+
import { Mastra } from '@mastra/core'
|
|
38
|
+
|
|
37
39
|
export const mastra = new Mastra({
|
|
38
40
|
agents: { supportAgent },
|
|
39
41
|
storage,
|
|
@@ -63,7 +65,7 @@ Visit the [Configuration reference](https://mastra.ai/reference/configuration) f
|
|
|
63
65
|
|
|
64
66
|
**logger** (`Logger`): Logger instance created with new PinoLogger() (Default: `Console logger with INFO level`)
|
|
65
67
|
|
|
66
|
-
**loggerOptions** (`{ correlation?: boolean; export?: boolean }`): Controls logger observability behavior. correlation injects
|
|
68
|
+
**loggerOptions** (`{ correlation?: boolean; export?: boolean }`): Controls logger observability behavior. correlation injects trace_id/span_id into native log output during traced operations; export forwards log records to observability storage. (Default: `{ correlation: true, export: true }`)
|
|
67
69
|
|
|
68
70
|
**idGenerator** (`(context?: IdGeneratorContext) => string`): Custom ID generator function. Used by agents, workflows, memory, and other components to generate unique identifiers. Receives optional context such as idType, source, entityId, and threadId to support context-aware ID formats.
|
|
69
71
|
|
|
@@ -73,7 +75,7 @@ Visit the [Configuration reference](https://mastra.ai/reference/configuration) f
|
|
|
73
75
|
|
|
74
76
|
**observability** (`ObservabilityEntrypoint`): Observability configuration for tracing and monitoring
|
|
75
77
|
|
|
76
|
-
**environment** (`string`): Deployment environment name (e.g. production, staging, development). When set, automatically attached to all observability signals so they can be filtered by environment without passing tracingOptions.metadata.environment on each call. When unset, resolves to development for mastra dev runs, then falls back to process.env.
|
|
78
|
+
**environment** (`string`): Deployment environment name (e.g. production, staging, development). When set, automatically attached to all observability signals so they can be filtered by environment without passing tracingOptions.metadata.environment on each call. When unset, resolves to development for mastra dev runs, then falls back to process.env.NODE_ENV; left undefined if none are set. Per-call tracingOptions.metadata.environment always takes precedence.
|
|
77
79
|
|
|
78
80
|
**deployer** (`MastraDeployer`): An instance of a MastraDeployer for managing deployments.
|
|
79
81
|
|
|
@@ -149,11 +151,11 @@ Requires persistent storage. With an in-memory store, there's nothing to recover
|
|
|
149
151
|
|
|
150
152
|
Recovery processes up to five agents concurrently, with up to five run waits per agent, independently of `recovery.workflowConcurrency`. Each built-in `recoverActiveRuns()` attempt waits up to 30 seconds in total for `recover()` setup and settlement of the whole recovered workflow, then frees its slot for another run. These limits bound waiting, not live executions. This isn't an overall recovery deadline: discovery and overridden custom recovery methods aren't bounded by this budget.
|
|
151
153
|
|
|
152
|
-
A timed-out attempt continues in the background. Its outcome is `status: 'skipped'` with `reason: 'recovery-timeout'` and a future `retryAt`. It contributes only to `skipped`, not `recovered`, `succeeded`, or `failed`. Mastra schedules re-checks automatically
|
|
154
|
+
A timed-out attempt continues in the background. Its outcome is `status: 'skipped'` with `reason: 'recovery-timeout'` and a future `retryAt`. It contributes only to `skipped`, not `recovered`, `succeeded`, or `failed`. Mastra schedules re-checks automatically, deferring them until the original attempt settles to avoid starting another execution. Recovery then checks the persisted snapshot and ownership before retrying and skips finished or suspended runs. The returned counts remain unchanged by late settlement.
|
|
153
155
|
|
|
154
156
|
When shutdown begins, recovery stops dispatching new agents and runs. The recovery traversal and original attempts, including timed-out setup or execution, participate in the same shared shutdown drain as active executions. A recovery wait timeout doesn't cancel the attempt or give it a separate shutdown drain window.
|
|
155
157
|
|
|
156
|
-
|
|
158
|
+
Mastra leaves a run under its current execution's control and counts it in `skipped`. Automatic re-checks begin once that execution's claim could have lapsed, allowing recovery after a process crash without another call. `shutdown()` cancels pending re-checks. See [run ownership](https://mastra.ai/docs/harness/durable-agents).
|
|
157
159
|
|
|
158
160
|
```typescript
|
|
159
161
|
const result = await mastra.recoverAllDurableAgents()
|
|
@@ -170,4 +172,4 @@ Returns:
|
|
|
170
172
|
|
|
171
173
|
**failed** (`number`): Runs whose restart threw an error.
|
|
172
174
|
|
|
173
|
-
**skipped** (`number`): Runs skipped because they are already active, recovery is already in progress, or the recovery wait timed out.
|
|
175
|
+
**skipped** (`number`): Runs skipped because they are already active, recovery is already in progress, or the recovery wait timed out. Skips with a future retryAt, including recovery timeouts, are automatically re-checked. Timeout re-checks wait for the original attempt to settle before deciding whether to retry.
|
|
@@ -36,7 +36,7 @@ export const mastra = new Mastra({
|
|
|
36
36
|
|
|
37
37
|
**prettyPrint** (`boolean`): When false, disables pino-pretty and writes raw JSON lines (useful for log aggregators). (Default: `true`)
|
|
38
38
|
|
|
39
|
-
**mixin** (`pino.
|
|
39
|
+
**mixin** (`pino.LoggerOptions['mixin']`): Pino mixin function merged into every log object (for example request-scoped traceId or other shared metadata).
|
|
40
40
|
|
|
41
41
|
**customLevels** (`Record<string, number>`): Custom log levels and numeric values, forwarded to Pino. Standard severity is still logged via debug, info, warn, and error; extra levels follow Pino’s custom-level behavior.
|
|
42
42
|
|
package/dist/file/index.cjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_pagination = require("../pagination-
|
|
2
|
+
const require_pagination = require("../pagination-BwV-2IW0.cjs");
|
|
3
3
|
let _mastra_core_logger = require("@mastra/core/logger");
|
|
4
4
|
let fs = require("fs");
|
|
5
5
|
let readline = require("readline");
|
|
6
6
|
let _mastra_core_error = require("@mastra/core/error");
|
|
7
|
-
|
|
7
|
+
// src/file/index.ts
|
|
8
8
|
var FileTransport = class extends _mastra_core_logger.LoggerTransport {
|
|
9
9
|
path;
|
|
10
10
|
fileStream;
|
|
@@ -130,7 +130,6 @@ var FileTransport = class extends _mastra_core_logger.LoggerTransport {
|
|
|
130
130
|
};
|
|
131
131
|
}
|
|
132
132
|
};
|
|
133
|
-
//#endregion
|
|
134
133
|
exports.FileTransport = FileTransport;
|
|
135
134
|
|
|
136
135
|
//# sourceMappingURL=index.cjs.map
|
package/dist/file/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { t as normalizePagination } from "../pagination-
|
|
1
|
+
import { t as normalizePagination } from "../pagination-B6HKeXNa.js";
|
|
2
2
|
import { LoggerTransport } from "@mastra/core/logger";
|
|
3
3
|
import { createReadStream, createWriteStream, existsSync, statSync } from "fs";
|
|
4
4
|
import { createInterface } from "readline";
|
|
5
5
|
import { ErrorCategory, ErrorDomain, MastraError } from "@mastra/core/error";
|
|
6
|
-
|
|
6
|
+
// src/file/index.ts
|
|
7
7
|
var FileTransport = class extends LoggerTransport {
|
|
8
8
|
path;
|
|
9
9
|
fileStream;
|
|
@@ -129,7 +129,6 @@ var FileTransport = class extends LoggerTransport {
|
|
|
129
129
|
};
|
|
130
130
|
}
|
|
131
131
|
};
|
|
132
|
-
//#endregion
|
|
133
132
|
export { FileTransport };
|
|
134
133
|
|
|
135
134
|
//# sourceMappingURL=index.js.map
|
package/dist/http/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
let _mastra_core_logger = require("@mastra/core/logger");
|
|
3
|
-
|
|
3
|
+
// src/http/index.ts
|
|
4
4
|
var HttpResponseError = class extends Error {
|
|
5
5
|
status;
|
|
6
6
|
retryAfterMs;
|
|
@@ -220,7 +220,6 @@ var HttpTransport = class extends _mastra_core_logger.LoggerTransport {
|
|
|
220
220
|
return this.lastFlush;
|
|
221
221
|
}
|
|
222
222
|
};
|
|
223
|
-
//#endregion
|
|
224
223
|
exports.HttpTransport = HttpTransport;
|
|
225
224
|
|
|
226
225
|
//# sourceMappingURL=index.cjs.map
|
package/dist/http/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { LoggerTransport } from "@mastra/core/logger";
|
|
2
|
-
|
|
2
|
+
// src/http/index.ts
|
|
3
3
|
var HttpResponseError = class extends Error {
|
|
4
4
|
status;
|
|
5
5
|
retryAfterMs;
|
|
@@ -219,7 +219,6 @@ var HttpTransport = class extends LoggerTransport {
|
|
|
219
219
|
return this.lastFlush;
|
|
220
220
|
}
|
|
221
221
|
};
|
|
222
|
-
//#endregion
|
|
223
222
|
export { HttpTransport };
|
|
224
223
|
|
|
225
224
|
//# sourceMappingURL=index.js.map
|
package/dist/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
|
|
2
|
+
// \0rolldown/runtime.js
|
|
3
3
|
var __create = Object.create;
|
|
4
4
|
var __defProp = Object.defineProperty;
|
|
5
5
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -20,13 +20,12 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
20
20
|
value: mod,
|
|
21
21
|
enumerable: true
|
|
22
22
|
}) : target, mod));
|
|
23
|
-
//#endregion
|
|
24
23
|
let _mastra_core_logger = require("@mastra/core/logger");
|
|
25
24
|
let pino = require("pino");
|
|
26
25
|
pino = __toESM(pino, 1);
|
|
27
26
|
let pino_pretty = require("pino-pretty");
|
|
28
27
|
pino_pretty = __toESM(pino_pretty, 1);
|
|
29
|
-
|
|
28
|
+
// src/pino.ts
|
|
30
29
|
/**
|
|
31
30
|
* Provides Pino-backed logging for Mastra applications.
|
|
32
31
|
*
|
|
@@ -186,7 +185,6 @@ var PinoLogger = class PinoLogger extends _mastra_core_logger.MastraLogger {
|
|
|
186
185
|
(0, _mastra_core_logger.exportTrackedException)(this.#adapterContextRef.current, error, metadata);
|
|
187
186
|
}
|
|
188
187
|
};
|
|
189
|
-
//#endregion
|
|
190
188
|
exports.PinoLogger = PinoLogger;
|
|
191
189
|
|
|
192
190
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["MastraLogger","pretty","LogLevel","buildLogRecordData"],"sources":["../src/pino.ts"],"sourcesContent":["import type { LoggerTransport, LoggerAdapterContext } from '@mastra/core/logger';\nimport { LogLevel, MastraLogger, buildLogRecordData, exportTrackedException } from '@mastra/core/logger';\nimport pino from 'pino';\nimport pretty from 'pino-pretty';\n\ntype TransportMap = Record<string, LoggerTransport>;\n\n// pino 10.4 no longer exports `pino.MixinFn`, so derive it from the options type.\ntype PinoMixinFn<CustomLevels extends string> = NonNullable<pino.LoggerOptions<CustomLevels>['mixin']>;\n\nexport type { LogLevel } from '@mastra/core/logger';\n\nexport interface PinoLoggerOptions<CustomLevels extends string = never> {\n name?: string;\n level?: LogLevel;\n transports?: TransportMap;\n overrideDefaultTransports?: boolean;\n formatters?: pino.LoggerOptions['formatters'];\n redact?: pino.LoggerOptions['redact'];\n mixin?: PinoMixinFn<CustomLevels>;\n customLevels?: { [level in CustomLevels]: number };\n /**\n * When false, disables pino-pretty and outputs raw JSON.\n * Useful when sending logs to aggregators like Datadog,\n * Loki, or CloudWatch that expect single-line JSON per entry.\n * @default true\n */\n prettyPrint?: boolean;\n /**\n * Override the key used for the log message.\n * Defaults to Pino's built-in 'msg' key.\n * Set to 'message' for compatibility with Google Cloud Logging,\n * Elastic Common Schema (ECS), Datadog, and AWS CloudWatch.\n * @example 'message'\n */\n messageKey?: string;\n /**\n * Custom pino serializers, merged over Mastra's defaults.\n * By default the `error` key is serialized with pino's standard error\n * serializer (alongside pino's built-in `err`), so that\n * `logger.warn('...', { error })` records the message and stack rather\n * than an empty object.\n */\n serializers?: pino.LoggerOptions['serializers'];\n}\n\ninterface PinoLoggerInternalOptions<CustomLevels extends string = never> extends PinoLoggerOptions<CustomLevels> {\n /** @internal Used internally for child loggers */\n _logger?: pino.Logger<CustomLevels>;\n /** @internal Shared adapter-context ref so root and children correlate together */\n _adapterContextRef?: { current?: LoggerAdapterContext };\n}\n\n/**\n * Provides Pino-backed logging for Mastra applications.\n *\n * @example\n * ```typescript\n * import { Mastra } from '@mastra/core/mastra';\n * import { PinoLogger } from '@mastra/loggers';\n *\n * const mastra = new Mastra({\n * logger: new PinoLogger({ name: 'my-app', level: 'info' }),\n * });\n * ```\n *\n * @see For documentation bundled with your installed package, locate\n * `@mastra/loggers/package.json` with your project's resolver or package-manager\n * tooling, then read `dist/docs/SKILL.md` from that package root and follow its\n * reference links. Use package-manager tools for virtual or archived packages.\n *\n * @see [Pino logger documentation](https://mastra.ai/reference/logging/pino-logger)\n * if packaged docs are unavailable.\n */\nexport class PinoLogger<CustomLevels extends string = never> extends MastraLogger {\n protected logger: pino.Logger<CustomLevels>;\n // Mutable ref shared with child loggers: the root's mixin (which children's\n // pino instances inherit) reads through this ref, so attaching observability\n // to a child (e.g. `new Mastra({ logger: base.child({...}) })`) correlates\n // the records it actually logs through.\n #adapterContextRef: { current?: LoggerAdapterContext };\n\n constructor(options: PinoLoggerOptions<CustomLevels> = {}) {\n super(options);\n\n const internalOptions = options as PinoLoggerInternalOptions<CustomLevels>;\n this.#adapterContextRef = internalOptions._adapterContextRef ?? {};\n\n // If an existing pino logger is provided (for child loggers), use it directly\n if (internalOptions._logger) {\n this.logger = internalOptions._logger;\n return;\n }\n\n // Compose the user mixin with trace correlation. Pino mixins run\n // synchronously on every log call, so the trace fields land in the\n // native record before serialization — for ALL destinations (stdout,\n // transports, files). Trace fields win on key conflicts.\n const userMixin = options.mixin;\n const correlationMixin: PinoMixinFn<CustomLevels> = (mergeObject, level, logger) => {\n const userFields = userMixin ? userMixin(mergeObject, level, logger) : {};\n const ctx = this.#adapterContextRef.current;\n if (!ctx?.options.correlation) return userFields;\n try {\n return { ...userFields, ...(ctx.resolveTraceFields() ?? {}) };\n } catch {\n return userFields;\n }\n };\n\n const shouldPrettyPrint = options.prettyPrint ?? true;\n let prettyStream: ReturnType<typeof pretty> | undefined = undefined;\n if (!options.overrideDefaultTransports && shouldPrettyPrint) {\n prettyStream = pretty({\n colorize: true,\n levelFirst: true,\n ignore: 'pid,hostname,component',\n colorizeObjects: true,\n translateTime: 'SYS:standard',\n singleLine: false,\n });\n }\n\n const transportsAry = [...this.getTransports().entries()];\n this.logger = pino(\n {\n name: options.name || 'app',\n level: options.level || LogLevel.INFO,\n formatters: options.formatters,\n redact: options.redact,\n mixin: correlationMixin,\n customLevels: options.customLevels,\n messageKey: options.messageKey ?? 'msg',\n // Pino applies its error serializer only to `errorKey` (default `err`).\n // Mastra logs errors as `{ error }` throughout, and an Error's `message`\n // and `stack` are non-enumerable, so without this they serialize to `{}`.\n serializers: { error: pino.stdSerializers.err, ...options.serializers },\n },\n options.overrideDefaultTransports\n ? options?.transports?.default\n : transportsAry.length === 0\n ? prettyStream // undefined when prettyPrint:false → pino native JSON\n : pino.multistream([\n ...transportsAry.map(([, transport]) => ({\n stream: transport,\n level: options.level || LogLevel.INFO,\n })),\n ...(prettyStream // only add prettyStream to multistream if it exists\n ? [{ stream: prettyStream, level: options.level || LogLevel.INFO }]\n : []),\n ]),\n );\n }\n\n /**\n * Creates a child logger with additional bound context.\n * All logs from the child logger will include the bound context.\n *\n * @param bindings - Key-value pairs to include in all logs from this child logger\n * @returns A new PinoLogger instance with the bound context\n *\n * @example\n * ```typescript\n * const baseLogger = new PinoLogger({ name: 'MyApp' });\n *\n * // Create module-scoped logger\n * const serviceLogger = baseLogger.child({ module: 'UserService' });\n * serviceLogger.info('User created', { userId: '123' });\n * // Output includes: { module: 'UserService', userId: '123', msg: 'User created' }\n *\n * // Create request-scoped logger\n * const requestLogger = baseLogger.child({ requestId: req.id });\n * requestLogger.error('Request failed', { err: error });\n * // Output includes: { requestId: 'abc', msg: 'Request failed', err: {...} }\n * ```\n */\n child(bindings: Record<string, unknown>): PinoLogger<CustomLevels> {\n const childPino = this.logger.child(bindings);\n const childOptions: PinoLoggerInternalOptions<CustomLevels> = {\n name: this.name,\n level: this.level,\n transports: Object.fromEntries(this.transports),\n _logger: childPino,\n _adapterContextRef: this.#adapterContextRef,\n };\n return new PinoLogger(childOptions);\n }\n\n /**\n * Adapter hook (see `AdaptableLogger` in `@mastra/core/logger`): enables\n * native trace correlation (trace_id/span_id merged into the pino record\n * via mixin, for every destination) and observability export derived from\n * the same record. Called by Mastra during setup.\n */\n __attachObservability(ctx: LoggerAdapterContext): void {\n // Shared ref: attaching to a child also enables correlation on the root\n // mixin the child's records flow through (and vice versa).\n this.#adapterContextRef.current = ctx;\n }\n\n /**\n * The adapter context lives on the ref cell shared by the whole\n * root/child family, so re-attach detection (multi-Mastra warning) must\n * key on that cell — attaching to a child re-targets the root too.\n */\n __observabilityAttachmentKey(): object {\n return this.#adapterContextRef;\n }\n\n /**\n * Export the record derived from the same native call to observability.\n * Runs regardless of pino's level filter and never throws into the caller.\n */\n #export(level: 'debug' | 'info' | 'warn' | 'error', message: string, args: Record<string, any>): void {\n const ctx = this.#adapterContextRef.current;\n if (!ctx?.options.export) return;\n try {\n // An Error passed as the args value often has no enumerable keys but\n // must still be exported (serialized by buildLogRecordData).\n const hasPayload = args instanceof Error || Object.keys(args).length > 0;\n // Trace identity travels on ExportedLog.traceId/spanId (the sink is\n // span-correlated); data stays reserved for the user payload. The mixin\n // still injects trace fields into the native pino record for stdout.\n ctx.getLogSink()?.[level](message, buildLogRecordData(hasPayload ? [args] : []));\n } catch {\n // Never let observability export break the primary logger\n }\n }\n\n debug(message: string, args: Record<string, any> = {}): void {\n this.logger.debug(args, message);\n this.#export('debug', message, args);\n }\n\n info(message: string, args: Record<string, any> = {}): void {\n this.logger.info(args, message);\n this.#export('info', message, args);\n }\n\n warn(message: string, args: Record<string, any> = {}): void {\n this.logger.warn(args, message);\n this.#export('warn', message, args);\n }\n\n error(message: string, args: Record<string, any> = {}): void {\n this.logger.error(args, message);\n this.#export('error', message, args);\n }\n\n override trackException(error: Error, metadata?: Record<string, unknown>): void {\n exportTrackedException(this.#adapterContextRef.current, error, metadata);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0EA,IAAa,aAAb,MAAa,mBAAwDA,oBAAAA,aAAa;CAChF;CAKA;CAEA,YAAY,UAA2C,CAAC,GAAG;EACzD,MAAM,OAAO;EAEb,MAAM,kBAAkB;EACxB,KAAK,qBAAqB,gBAAgB,sBAAsB,CAAC;EAGjE,IAAI,gBAAgB,SAAS;GAC3B,KAAK,SAAS,gBAAgB;GAC9B;EACF;EAMA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;AACF"}
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["MastraLogger","pretty","LogLevel","buildLogRecordData"],"sources":["../src/pino.ts"],"sourcesContent":["import type { LoggerTransport, LoggerAdapterContext } from '@mastra/core/logger';\nimport { LogLevel, MastraLogger, buildLogRecordData, exportTrackedException } from '@mastra/core/logger';\nimport pino from 'pino';\nimport pretty from 'pino-pretty';\n\ntype TransportMap = Record<string, LoggerTransport>;\n\n// pino 10.4 no longer exports `pino.MixinFn`, so derive it from the options type.\ntype PinoMixinFn<CustomLevels extends string> = NonNullable<pino.LoggerOptions<CustomLevels>['mixin']>;\n\nexport type { LogLevel } from '@mastra/core/logger';\n\nexport interface PinoLoggerOptions<CustomLevels extends string = never> {\n name?: string;\n level?: LogLevel;\n transports?: TransportMap;\n overrideDefaultTransports?: boolean;\n formatters?: pino.LoggerOptions['formatters'];\n redact?: pino.LoggerOptions['redact'];\n mixin?: PinoMixinFn<CustomLevels>;\n customLevels?: { [level in CustomLevels]: number };\n /**\n * When false, disables pino-pretty and outputs raw JSON.\n * Useful when sending logs to aggregators like Datadog,\n * Loki, or CloudWatch that expect single-line JSON per entry.\n * @default true\n */\n prettyPrint?: boolean;\n /**\n * Override the key used for the log message.\n * Defaults to Pino's built-in 'msg' key.\n * Set to 'message' for compatibility with Google Cloud Logging,\n * Elastic Common Schema (ECS), Datadog, and AWS CloudWatch.\n * @example 'message'\n */\n messageKey?: string;\n /**\n * Custom pino serializers, merged over Mastra's defaults.\n * By default the `error` key is serialized with pino's standard error\n * serializer (alongside pino's built-in `err`), so that\n * `logger.warn('...', { error })` records the message and stack rather\n * than an empty object.\n */\n serializers?: pino.LoggerOptions['serializers'];\n}\n\ninterface PinoLoggerInternalOptions<CustomLevels extends string = never> extends PinoLoggerOptions<CustomLevels> {\n /** @internal Used internally for child loggers */\n _logger?: pino.Logger<CustomLevels>;\n /** @internal Shared adapter-context ref so root and children correlate together */\n _adapterContextRef?: { current?: LoggerAdapterContext };\n}\n\n/**\n * Provides Pino-backed logging for Mastra applications.\n *\n * @example\n * ```typescript\n * import { Mastra } from '@mastra/core/mastra';\n * import { PinoLogger } from '@mastra/loggers';\n *\n * const mastra = new Mastra({\n * logger: new PinoLogger({ name: 'my-app', level: 'info' }),\n * });\n * ```\n *\n * @see For documentation bundled with your installed package, locate\n * `@mastra/loggers/package.json` with your project's resolver or package-manager\n * tooling, then read `dist/docs/SKILL.md` from that package root and follow its\n * reference links. Use package-manager tools for virtual or archived packages.\n *\n * @see [Pino logger documentation](https://mastra.ai/reference/logging/pino-logger)\n * if packaged docs are unavailable.\n */\nexport class PinoLogger<CustomLevels extends string = never> extends MastraLogger {\n protected logger: pino.Logger<CustomLevels>;\n // Mutable ref shared with child loggers: the root's mixin (which children's\n // pino instances inherit) reads through this ref, so attaching observability\n // to a child (e.g. `new Mastra({ logger: base.child({...}) })`) correlates\n // the records it actually logs through.\n #adapterContextRef: { current?: LoggerAdapterContext };\n\n constructor(options: PinoLoggerOptions<CustomLevels> = {}) {\n super(options);\n\n const internalOptions = options as PinoLoggerInternalOptions<CustomLevels>;\n this.#adapterContextRef = internalOptions._adapterContextRef ?? {};\n\n // If an existing pino logger is provided (for child loggers), use it directly\n if (internalOptions._logger) {\n this.logger = internalOptions._logger;\n return;\n }\n\n // Compose the user mixin with trace correlation. Pino mixins run\n // synchronously on every log call, so the trace fields land in the\n // native record before serialization — for ALL destinations (stdout,\n // transports, files). Trace fields win on key conflicts.\n const userMixin = options.mixin;\n const correlationMixin: PinoMixinFn<CustomLevels> = (mergeObject, level, logger) => {\n const userFields = userMixin ? userMixin(mergeObject, level, logger) : {};\n const ctx = this.#adapterContextRef.current;\n if (!ctx?.options.correlation) return userFields;\n try {\n return { ...userFields, ...(ctx.resolveTraceFields() ?? {}) };\n } catch {\n return userFields;\n }\n };\n\n const shouldPrettyPrint = options.prettyPrint ?? true;\n let prettyStream: ReturnType<typeof pretty> | undefined = undefined;\n if (!options.overrideDefaultTransports && shouldPrettyPrint) {\n prettyStream = pretty({\n colorize: true,\n levelFirst: true,\n ignore: 'pid,hostname,component',\n colorizeObjects: true,\n translateTime: 'SYS:standard',\n singleLine: false,\n });\n }\n\n const transportsAry = [...this.getTransports().entries()];\n this.logger = pino(\n {\n name: options.name || 'app',\n level: options.level || LogLevel.INFO,\n formatters: options.formatters,\n redact: options.redact,\n mixin: correlationMixin,\n customLevels: options.customLevels,\n messageKey: options.messageKey ?? 'msg',\n // Pino applies its error serializer only to `errorKey` (default `err`).\n // Mastra logs errors as `{ error }` throughout, and an Error's `message`\n // and `stack` are non-enumerable, so without this they serialize to `{}`.\n serializers: { error: pino.stdSerializers.err, ...options.serializers },\n },\n options.overrideDefaultTransports\n ? options?.transports?.default\n : transportsAry.length === 0\n ? prettyStream // undefined when prettyPrint:false → pino native JSON\n : pino.multistream([\n ...transportsAry.map(([, transport]) => ({\n stream: transport,\n level: options.level || LogLevel.INFO,\n })),\n ...(prettyStream // only add prettyStream to multistream if it exists\n ? [{ stream: prettyStream, level: options.level || LogLevel.INFO }]\n : []),\n ]),\n );\n }\n\n /**\n * Creates a child logger with additional bound context.\n * All logs from the child logger will include the bound context.\n *\n * @param bindings - Key-value pairs to include in all logs from this child logger\n * @returns A new PinoLogger instance with the bound context\n *\n * @example\n * ```typescript\n * const baseLogger = new PinoLogger({ name: 'MyApp' });\n *\n * // Create module-scoped logger\n * const serviceLogger = baseLogger.child({ module: 'UserService' });\n * serviceLogger.info('User created', { userId: '123' });\n * // Output includes: { module: 'UserService', userId: '123', msg: 'User created' }\n *\n * // Create request-scoped logger\n * const requestLogger = baseLogger.child({ requestId: req.id });\n * requestLogger.error('Request failed', { err: error });\n * // Output includes: { requestId: 'abc', msg: 'Request failed', err: {...} }\n * ```\n */\n child(bindings: Record<string, unknown>): PinoLogger<CustomLevels> {\n const childPino = this.logger.child(bindings);\n const childOptions: PinoLoggerInternalOptions<CustomLevels> = {\n name: this.name,\n level: this.level,\n transports: Object.fromEntries(this.transports),\n _logger: childPino,\n _adapterContextRef: this.#adapterContextRef,\n };\n return new PinoLogger(childOptions);\n }\n\n /**\n * Adapter hook (see `AdaptableLogger` in `@mastra/core/logger`): enables\n * native trace correlation (trace_id/span_id merged into the pino record\n * via mixin, for every destination) and observability export derived from\n * the same record. Called by Mastra during setup.\n */\n __attachObservability(ctx: LoggerAdapterContext): void {\n // Shared ref: attaching to a child also enables correlation on the root\n // mixin the child's records flow through (and vice versa).\n this.#adapterContextRef.current = ctx;\n }\n\n /**\n * The adapter context lives on the ref cell shared by the whole\n * root/child family, so re-attach detection (multi-Mastra warning) must\n * key on that cell — attaching to a child re-targets the root too.\n */\n __observabilityAttachmentKey(): object {\n return this.#adapterContextRef;\n }\n\n /**\n * Export the record derived from the same native call to observability.\n * Runs regardless of pino's level filter and never throws into the caller.\n */\n #export(level: 'debug' | 'info' | 'warn' | 'error', message: string, args: Record<string, any>): void {\n const ctx = this.#adapterContextRef.current;\n if (!ctx?.options.export) return;\n try {\n // An Error passed as the args value often has no enumerable keys but\n // must still be exported (serialized by buildLogRecordData).\n const hasPayload = args instanceof Error || Object.keys(args).length > 0;\n // Trace identity travels on ExportedLog.traceId/spanId (the sink is\n // span-correlated); data stays reserved for the user payload. The mixin\n // still injects trace fields into the native pino record for stdout.\n ctx.getLogSink()?.[level](message, buildLogRecordData(hasPayload ? [args] : []));\n } catch {\n // Never let observability export break the primary logger\n }\n }\n\n debug(message: string, args: Record<string, any> = {}): void {\n this.logger.debug(args, message);\n this.#export('debug', message, args);\n }\n\n info(message: string, args: Record<string, any> = {}): void {\n this.logger.info(args, message);\n this.#export('info', message, args);\n }\n\n warn(message: string, args: Record<string, any> = {}): void {\n this.logger.warn(args, message);\n this.#export('warn', message, args);\n }\n\n error(message: string, args: Record<string, any> = {}): void {\n this.logger.error(args, message);\n this.#export('error', message, args);\n }\n\n override trackException(error: Error, metadata?: Record<string, unknown>): void {\n exportTrackedException(this.#adapterContextRef.current, error, metadata);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;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O;EAC9B,KAAK,QAAQ,QAAQ,SAAS,IAAI;CACpC;CAEA,MAAM,SAAiB,OAA4B,CAAC,GAAS;EAC3D,KAAK,OAAO,MAAM,MAAM,OAAO;EAC/B,KAAK,QAAQ,SAAS,SAAS,IAAI;CACrC;CAEA,eAAwB,OAAc,UAA0C;EAC9E,CAAA,GAAA,oBAAA,uBAAA,CAAuB,KAAK,mBAAmB,SAAS,OAAO,QAAQ;CACzE;AACF"}
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { LogLevel, MastraLogger, buildLogRecordData, exportTrackedException } from "@mastra/core/logger";
|
|
2
2
|
import pino from "pino";
|
|
3
3
|
import pretty from "pino-pretty";
|
|
4
|
-
|
|
4
|
+
// src/pino.ts
|
|
5
5
|
/**
|
|
6
6
|
* Provides Pino-backed logging for Mastra applications.
|
|
7
7
|
*
|
|
@@ -161,7 +161,6 @@ var PinoLogger = class PinoLogger extends MastraLogger {
|
|
|
161
161
|
exportTrackedException(this.#adapterContextRef.current, error, metadata);
|
|
162
162
|
}
|
|
163
163
|
};
|
|
164
|
-
//#endregion
|
|
165
164
|
export { PinoLogger };
|
|
166
165
|
|
|
167
166
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/pagination.ts
|
|
2
2
|
/**
|
|
3
3
|
* Normalizes and validates log query pagination. `page: 0` aliases page 1 and
|
|
4
4
|
* `perPage: 0` aliases the default of 100. Throws RangeError for anything that
|
|
@@ -19,7 +19,6 @@ function normalizePagination(pageInput, perPageInput) {
|
|
|
19
19
|
end
|
|
20
20
|
};
|
|
21
21
|
}
|
|
22
|
-
//#endregion
|
|
23
22
|
export { normalizePagination as t };
|
|
24
23
|
|
|
25
|
-
//# sourceMappingURL=pagination-
|
|
24
|
+
//# sourceMappingURL=pagination-B6HKeXNa.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pagination-
|
|
1
|
+
{"version":3,"file":"pagination-B6HKeXNa.js","names":[],"sources":["../src/pagination.ts"],"sourcesContent":["/**\n * Normalizes and validates log query pagination. `page: 0` aliases page 1 and\n * `perPage: 0` aliases the default of 100. Throws RangeError for anything that\n * is not a positive safe integer, or whose range would exceed safe integers.\n */\nexport function normalizePagination(pageInput?: number, perPageInput?: number) {\n const page = pageInput === undefined || pageInput === 0 ? 1 : pageInput;\n const perPage = perPageInput === undefined || perPageInput === 0 ? 100 : perPageInput;\n\n if (!Number.isSafeInteger(page) || page < 1) {\n throw new RangeError(`Invalid page: ${pageInput}. Expected a positive integer.`);\n }\n if (!Number.isSafeInteger(perPage) || perPage < 1) {\n throw new RangeError(`Invalid perPage: ${perPageInput}. Expected a positive integer.`);\n }\n\n const start = (page - 1) * perPage;\n const end = start + perPage;\n if (!Number.isSafeInteger(end)) {\n throw new RangeError(`Pagination range too large: page ${page}, perPage ${perPage}.`);\n }\n\n return { page, perPage, start, end };\n}\n"],"mappings":";;;;;;AAKA,SAAgB,oBAAoB,WAAoB,cAAuB;CAC7E,MAAM,OAAO,cAAc,KAAA,KAAa,cAAc,IAAI,IAAI;CAC9D,MAAM,UAAU,iBAAiB,KAAA,KAAa,iBAAiB,IAAI,MAAM;CAEzE,IAAI,CAAC,OAAO,cAAc,IAAI,KAAK,OAAO,GACxC,MAAM,IAAI,WAAW,iBAAiB,UAAU,+BAA+B;CAEjF,IAAI,CAAC,OAAO,cAAc,OAAO,KAAK,UAAU,GAC9C,MAAM,IAAI,WAAW,oBAAoB,aAAa,+BAA+B;CAGvF,MAAM,SAAS,OAAO,KAAK;CAC3B,MAAM,MAAM,QAAQ;CACpB,IAAI,CAAC,OAAO,cAAc,GAAG,GAC3B,MAAM,IAAI,WAAW,oCAAoC,KAAK,YAAY,QAAQ,EAAE;CAGtF,OAAO;EAAE;EAAM;EAAS;EAAO;CAAI;AACrC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/pagination.ts
|
|
2
2
|
/**
|
|
3
3
|
* Normalizes and validates log query pagination. `page: 0` aliases page 1 and
|
|
4
4
|
* `perPage: 0` aliases the default of 100. Throws RangeError for anything that
|
|
@@ -19,7 +19,6 @@ function normalizePagination(pageInput, perPageInput) {
|
|
|
19
19
|
end
|
|
20
20
|
};
|
|
21
21
|
}
|
|
22
|
-
//#endregion
|
|
23
22
|
Object.defineProperty(exports, "normalizePagination", {
|
|
24
23
|
enumerable: true,
|
|
25
24
|
get: function() {
|
|
@@ -27,4 +26,4 @@ Object.defineProperty(exports, "normalizePagination", {
|
|
|
27
26
|
}
|
|
28
27
|
});
|
|
29
28
|
|
|
30
|
-
//# sourceMappingURL=pagination-
|
|
29
|
+
//# sourceMappingURL=pagination-BwV-2IW0.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pagination-
|
|
1
|
+
{"version":3,"file":"pagination-BwV-2IW0.cjs","names":[],"sources":["../src/pagination.ts"],"sourcesContent":["/**\n * Normalizes and validates log query pagination. `page: 0` aliases page 1 and\n * `perPage: 0` aliases the default of 100. Throws RangeError for anything that\n * is not a positive safe integer, or whose range would exceed safe integers.\n */\nexport function normalizePagination(pageInput?: number, perPageInput?: number) {\n const page = pageInput === undefined || pageInput === 0 ? 1 : pageInput;\n const perPage = perPageInput === undefined || perPageInput === 0 ? 100 : perPageInput;\n\n if (!Number.isSafeInteger(page) || page < 1) {\n throw new RangeError(`Invalid page: ${pageInput}. Expected a positive integer.`);\n }\n if (!Number.isSafeInteger(perPage) || perPage < 1) {\n throw new RangeError(`Invalid perPage: ${perPageInput}. Expected a positive integer.`);\n }\n\n const start = (page - 1) * perPage;\n const end = start + perPage;\n if (!Number.isSafeInteger(end)) {\n throw new RangeError(`Pagination range too large: page ${page}, perPage ${perPage}.`);\n }\n\n return { page, perPage, start, end };\n}\n"],"mappings":";;;;;;AAKA,SAAgB,oBAAoB,WAAoB,cAAuB;CAC7E,MAAM,OAAO,cAAc,KAAA,KAAa,cAAc,IAAI,IAAI;CAC9D,MAAM,UAAU,iBAAiB,KAAA,KAAa,iBAAiB,IAAI,MAAM;CAEzE,IAAI,CAAC,OAAO,cAAc,IAAI,KAAK,OAAO,GACxC,MAAM,IAAI,WAAW,iBAAiB,UAAU,+BAA+B;CAEjF,IAAI,CAAC,OAAO,cAAc,OAAO,KAAK,UAAU,GAC9C,MAAM,IAAI,WAAW,oBAAoB,aAAa,+BAA+B;CAGvF,MAAM,SAAS,OAAO,KAAK;CAC3B,MAAM,MAAM,QAAQ;CACpB,IAAI,CAAC,OAAO,cAAc,GAAG,GAC3B,MAAM,IAAI,WAAW,oCAAoC,KAAK,YAAY,QAAQ,EAAE;CAGtF,OAAO;EAAE;EAAM;EAAS;EAAO;CAAI;AACrC"}
|
package/dist/upstash/index.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_pagination = require("../pagination-
|
|
2
|
+
const require_pagination = require("../pagination-BwV-2IW0.cjs");
|
|
3
3
|
let _mastra_core_logger = require("@mastra/core/logger");
|
|
4
|
-
|
|
4
|
+
// src/upstash/index.ts
|
|
5
5
|
/** LTRIM failed after LPUSH succeeded: the records were written, so they are not put back in the buffer. */
|
|
6
6
|
var UpstashTrimError = class extends Error {
|
|
7
7
|
name = "UpstashTrimError";
|
|
@@ -264,7 +264,6 @@ var UpstashTransport = class extends _mastra_core_logger.LoggerTransport {
|
|
|
264
264
|
}
|
|
265
265
|
}
|
|
266
266
|
};
|
|
267
|
-
//#endregion
|
|
268
267
|
exports.UpstashTransport = UpstashTransport;
|
|
269
268
|
|
|
270
269
|
//# sourceMappingURL=index.cjs.map
|
package/dist/upstash/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { t as normalizePagination } from "../pagination-
|
|
1
|
+
import { t as normalizePagination } from "../pagination-B6HKeXNa.js";
|
|
2
2
|
import { LoggerTransport } from "@mastra/core/logger";
|
|
3
|
-
|
|
3
|
+
// src/upstash/index.ts
|
|
4
4
|
/** LTRIM failed after LPUSH succeeded: the records were written, so they are not put back in the buffer. */
|
|
5
5
|
var UpstashTrimError = class extends Error {
|
|
6
6
|
name = "UpstashTrimError";
|
|
@@ -263,7 +263,6 @@ var UpstashTransport = class extends LoggerTransport {
|
|
|
263
263
|
}
|
|
264
264
|
}
|
|
265
265
|
};
|
|
266
|
-
//#endregion
|
|
267
266
|
export { UpstashTransport };
|
|
268
267
|
|
|
269
268
|
//# sourceMappingURL=index.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/loggers",
|
|
3
|
-
"version": "1.3.10
|
|
3
|
+
"version": "1.3.10",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
@@ -64,20 +64,20 @@
|
|
|
64
64
|
"author": "",
|
|
65
65
|
"license": "Apache-2.0",
|
|
66
66
|
"dependencies": {
|
|
67
|
-
"pino": "^10.
|
|
67
|
+
"pino": "^10.4.0",
|
|
68
68
|
"pino-pretty": "^13.2.0"
|
|
69
69
|
},
|
|
70
70
|
"devDependencies": {
|
|
71
|
-
"@types/node": "22.
|
|
72
|
-
"@vitest/coverage-v8": "4.1.
|
|
73
|
-
"@vitest/ui": "4.1.
|
|
71
|
+
"@types/node": "22.19.15",
|
|
72
|
+
"@vitest/coverage-v8": "4.1.12",
|
|
73
|
+
"@vitest/ui": "4.1.12",
|
|
74
74
|
"tsdown": "0.23.1",
|
|
75
|
-
"tsx": "^4.23.
|
|
75
|
+
"tsx": "^4.23.15",
|
|
76
76
|
"typescript": "^7.0.2",
|
|
77
|
-
"vitest": "4.1.
|
|
78
|
-
"@internal/lint": "0.0.
|
|
79
|
-
"@
|
|
80
|
-
"@
|
|
77
|
+
"vitest": "4.1.12",
|
|
78
|
+
"@internal/lint": "0.0.146",
|
|
79
|
+
"@internal/types-builder": "0.0.121",
|
|
80
|
+
"@mastra/core": "1.80.0"
|
|
81
81
|
},
|
|
82
82
|
"peerDependencies": {
|
|
83
83
|
"@mastra/core": ">=1.0.0-0 <2.0.0-0"
|