create-mastra 1.0.0-beta.5 → 1.0.0-beta.6
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/CHANGELOG.md +6 -0
- package/dist/index.js +40 -3
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
package/dist/index.js
CHANGED
|
@@ -18,9 +18,9 @@ import tty from 'node:tty';
|
|
|
18
18
|
import fsExtra, { readJSON, ensureFile, writeJSON } from 'fs-extra/esm';
|
|
19
19
|
import prettier from 'prettier';
|
|
20
20
|
import { execa } from 'execa';
|
|
21
|
+
import fsExtra$1 from 'fs-extra';
|
|
21
22
|
import pino from 'pino';
|
|
22
23
|
import pretty from 'pino-pretty';
|
|
23
|
-
import fsExtra$1 from 'fs-extra';
|
|
24
24
|
|
|
25
25
|
var __filename = fileURLToPath(import.meta.url);
|
|
26
26
|
var __dirname = path3.dirname(__filename);
|
|
@@ -1144,10 +1144,15 @@ var MastraLogger = class {
|
|
|
1144
1144
|
}
|
|
1145
1145
|
};
|
|
1146
1146
|
|
|
1147
|
-
var PinoLogger = class extends MastraLogger {
|
|
1147
|
+
var PinoLogger = class _PinoLogger extends MastraLogger {
|
|
1148
1148
|
logger;
|
|
1149
1149
|
constructor(options = {}) {
|
|
1150
1150
|
super(options);
|
|
1151
|
+
const internalOptions = options;
|
|
1152
|
+
if (internalOptions._logger) {
|
|
1153
|
+
this.logger = internalOptions._logger;
|
|
1154
|
+
return;
|
|
1155
|
+
}
|
|
1151
1156
|
let prettyStream = void 0;
|
|
1152
1157
|
if (!options.overrideDefaultTransports) {
|
|
1153
1158
|
prettyStream = pretty({
|
|
@@ -1178,6 +1183,38 @@ var PinoLogger = class extends MastraLogger {
|
|
|
1178
1183
|
])
|
|
1179
1184
|
);
|
|
1180
1185
|
}
|
|
1186
|
+
/**
|
|
1187
|
+
* Creates a child logger with additional bound context.
|
|
1188
|
+
* All logs from the child logger will include the bound context.
|
|
1189
|
+
*
|
|
1190
|
+
* @param bindings - Key-value pairs to include in all logs from this child logger
|
|
1191
|
+
* @returns A new PinoLogger instance with the bound context
|
|
1192
|
+
*
|
|
1193
|
+
* @example
|
|
1194
|
+
* ```typescript
|
|
1195
|
+
* const baseLogger = new PinoLogger({ name: 'MyApp' });
|
|
1196
|
+
*
|
|
1197
|
+
* // Create module-scoped logger
|
|
1198
|
+
* const serviceLogger = baseLogger.child({ module: 'UserService' });
|
|
1199
|
+
* serviceLogger.info('User created', { userId: '123' });
|
|
1200
|
+
* // Output includes: { module: 'UserService', userId: '123', msg: 'User created' }
|
|
1201
|
+
*
|
|
1202
|
+
* // Create request-scoped logger
|
|
1203
|
+
* const requestLogger = baseLogger.child({ requestId: req.id });
|
|
1204
|
+
* requestLogger.error('Request failed', { err: error });
|
|
1205
|
+
* // Output includes: { requestId: 'abc', msg: 'Request failed', err: {...} }
|
|
1206
|
+
* ```
|
|
1207
|
+
*/
|
|
1208
|
+
child(bindings) {
|
|
1209
|
+
const childPino = this.logger.child(bindings);
|
|
1210
|
+
const childOptions = {
|
|
1211
|
+
name: this.name,
|
|
1212
|
+
level: this.level,
|
|
1213
|
+
transports: Object.fromEntries(this.transports),
|
|
1214
|
+
_logger: childPino
|
|
1215
|
+
};
|
|
1216
|
+
return new _PinoLogger(childOptions);
|
|
1217
|
+
}
|
|
1181
1218
|
debug(message, args = {}) {
|
|
1182
1219
|
this.logger.debug(args, message);
|
|
1183
1220
|
}
|
|
@@ -1193,7 +1230,7 @@ var PinoLogger = class extends MastraLogger {
|
|
|
1193
1230
|
};
|
|
1194
1231
|
|
|
1195
1232
|
var package_default = {
|
|
1196
|
-
version: "1.0.0-beta.
|
|
1233
|
+
version: "1.0.0-beta.6"};
|
|
1197
1234
|
function getPackageManagerAddCommand(pm) {
|
|
1198
1235
|
switch (pm) {
|
|
1199
1236
|
case "npm":
|