@mastra/loggers 0.1.3 → 0.1.4
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/.turbo/turbo-build.log +6 -6
- package/CHANGELOG.md +10 -0
- package/dist/_tsup-dts-rollup.d.ts +2 -0
- package/dist/file/index.js +10 -0
- package/dist/upstash/index.js +12 -1
- package/package.json +2 -2
- package/src/file/index.ts +13 -0
- package/src/upstash/index.ts +15 -1
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
|
|
2
|
-
> @mastra/loggers@0.1.
|
|
2
|
+
> @mastra/loggers@0.1.4 build /home/runner/work/mastra/mastra/packages/loggers
|
|
3
3
|
> tsup src/file/index.ts src/upstash/index.ts --format esm --experimental-dts --clean --treeshake
|
|
4
4
|
|
|
5
5
|
[34mCLI[39m Building entry: src/file/index.ts, src/upstash/index.ts
|
|
6
6
|
[34mCLI[39m Using tsconfig: tsconfig.json
|
|
7
7
|
[34mCLI[39m tsup v8.3.6
|
|
8
8
|
[34mTSC[39m Build start
|
|
9
|
-
[32mTSC[39m ⚡️ Build success in
|
|
9
|
+
[32mTSC[39m ⚡️ Build success in 5564ms
|
|
10
10
|
[34mDTS[39m Build start
|
|
11
11
|
[34mCLI[39m Target: es2022
|
|
12
12
|
Analysis will use the bundled TypeScript version 5.7.3
|
|
13
13
|
[36mWriting package typings: /home/runner/work/mastra/mastra/packages/loggers/dist/_tsup-dts-rollup.d.ts[39m
|
|
14
|
-
[32mDTS[39m ⚡️ Build success in
|
|
14
|
+
[32mDTS[39m ⚡️ Build success in 4647ms
|
|
15
15
|
[34mCLI[39m Cleaning output folder
|
|
16
16
|
[34mESM[39m Build start
|
|
17
|
-
[32mESM[39m [1mdist/
|
|
18
|
-
[32mESM[39m [1mdist/
|
|
19
|
-
[32mESM[39m ⚡️ Build success in
|
|
17
|
+
[32mESM[39m [1mdist/file/index.js [22m[32m1.64 KB[39m
|
|
18
|
+
[32mESM[39m [1mdist/upstash/index.js [22m[32m3.72 KB[39m
|
|
19
|
+
[32mESM[39m ⚡️ Build success in 246ms
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# @mastra/loggers
|
|
2
2
|
|
|
3
|
+
## 0.1.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 967da43: Logger, transport fixes
|
|
8
|
+
- Updated dependencies [ce44b9b]
|
|
9
|
+
- Updated dependencies [967da43]
|
|
10
|
+
- Updated dependencies [b405f08]
|
|
11
|
+
- @mastra/core@0.4.1
|
|
12
|
+
|
|
3
13
|
## 0.1.3
|
|
4
14
|
|
|
5
15
|
### Patch Changes
|
|
@@ -10,6 +10,7 @@ export declare class FileTransport extends LoggerTransport {
|
|
|
10
10
|
});
|
|
11
11
|
_transform(chunk: any, _encoding: string, callback: (error: Error | null, chunk: any) => void): void;
|
|
12
12
|
_flush(callback: Function): void;
|
|
13
|
+
_write(chunk: any, encoding?: string, callback?: (error?: Error | null) => void): boolean;
|
|
13
14
|
_destroy(error: Error, callback: Function): void;
|
|
14
15
|
getLogs(): Promise<BaseLogMessage[]>;
|
|
15
16
|
getLogsByRunId({ runId }: {
|
|
@@ -37,6 +38,7 @@ export declare class UpstashTransport extends LoggerTransport {
|
|
|
37
38
|
});
|
|
38
39
|
private executeUpstashCommand;
|
|
39
40
|
_flush(): Promise<void>;
|
|
41
|
+
_write(chunk: any, encoding?: string, callback?: (error?: Error | null) => void): boolean;
|
|
40
42
|
_transform(chunk: string, _enc: string, cb: Function): void;
|
|
41
43
|
_destroy(err: Error, cb: Function): void;
|
|
42
44
|
getLogs(): Promise<BaseLogMessage[]>;
|
package/dist/file/index.js
CHANGED
|
@@ -27,6 +27,16 @@ var FileTransport = class extends LoggerTransport {
|
|
|
27
27
|
callback();
|
|
28
28
|
});
|
|
29
29
|
}
|
|
30
|
+
_write(chunk, encoding, callback) {
|
|
31
|
+
if (typeof callback === "function") {
|
|
32
|
+
this._transform(chunk, encoding || "utf8", callback);
|
|
33
|
+
return true;
|
|
34
|
+
}
|
|
35
|
+
this._transform(chunk, encoding || "utf8", (error) => {
|
|
36
|
+
if (error) console.error("Transform error in write:", error);
|
|
37
|
+
});
|
|
38
|
+
return true;
|
|
39
|
+
}
|
|
30
40
|
// Clean up resources
|
|
31
41
|
_destroy(error, callback) {
|
|
32
42
|
if (this.fileStream) {
|
package/dist/upstash/index.js
CHANGED
|
@@ -62,6 +62,16 @@ var UpstashTransport = class extends LoggerTransport {
|
|
|
62
62
|
throw error;
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
|
+
_write(chunk, encoding, callback) {
|
|
66
|
+
if (typeof callback === "function") {
|
|
67
|
+
this._transform(chunk, encoding || "utf8", callback);
|
|
68
|
+
return true;
|
|
69
|
+
}
|
|
70
|
+
this._transform(chunk, encoding || "utf8", (error) => {
|
|
71
|
+
if (error) console.error("Transform error in write:", error);
|
|
72
|
+
});
|
|
73
|
+
return true;
|
|
74
|
+
}
|
|
65
75
|
_transform(chunk, _enc, cb) {
|
|
66
76
|
try {
|
|
67
77
|
const log = typeof chunk === "string" ? JSON.parse(chunk) : chunk;
|
|
@@ -109,7 +119,8 @@ var UpstashTransport = class extends LoggerTransport {
|
|
|
109
119
|
async getLogsByRunId({ runId }) {
|
|
110
120
|
try {
|
|
111
121
|
const allLogs = await this.getLogs();
|
|
112
|
-
|
|
122
|
+
const logs = allLogs.filter((log) => log.runId === runId) || [];
|
|
123
|
+
return logs;
|
|
113
124
|
} catch (error) {
|
|
114
125
|
console.error("Error getting logs by runId from Upstash:", error);
|
|
115
126
|
return [];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/loggers",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"author": "",
|
|
31
31
|
"license": "ISC",
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@mastra/core": "^0.4.
|
|
33
|
+
"@mastra/core": "^0.4.1"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@microsoft/api-extractor": "^7.49.2",
|
package/src/file/index.ts
CHANGED
|
@@ -34,6 +34,19 @@ export class FileTransport extends LoggerTransport {
|
|
|
34
34
|
});
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
+
_write(chunk: any, encoding?: string, callback?: (error?: Error | null) => void): boolean {
|
|
38
|
+
if (typeof callback === 'function') {
|
|
39
|
+
this._transform(chunk, encoding || 'utf8', callback);
|
|
40
|
+
return true;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
this._transform(chunk, encoding || 'utf8', (error: Error | null) => {
|
|
44
|
+
if (error) console.error('Transform error in write:', error);
|
|
45
|
+
});
|
|
46
|
+
return true;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
|
|
37
50
|
// Clean up resources
|
|
38
51
|
_destroy(error: Error, callback: Function) {
|
|
39
52
|
if (this.fileStream) {
|
package/src/upstash/index.ts
CHANGED
|
@@ -88,6 +88,18 @@ export class UpstashTransport extends LoggerTransport {
|
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
+
_write(chunk: any, encoding?: string, callback?: (error?: Error | null) => void): boolean {
|
|
92
|
+
if (typeof callback === 'function') {
|
|
93
|
+
this._transform(chunk, encoding || 'utf8', callback);
|
|
94
|
+
return true;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
this._transform(chunk, encoding || 'utf8', (error: Error | null) => {
|
|
98
|
+
if (error) console.error('Transform error in write:', error);
|
|
99
|
+
});
|
|
100
|
+
return true;
|
|
101
|
+
}
|
|
102
|
+
|
|
91
103
|
_transform(chunk: string, _enc: string, cb: Function) {
|
|
92
104
|
try {
|
|
93
105
|
// Parse the log line if it's a string
|
|
@@ -154,10 +166,12 @@ export class UpstashTransport extends LoggerTransport {
|
|
|
154
166
|
async getLogsByRunId({ runId }: { runId: string }): Promise<BaseLogMessage[]> {
|
|
155
167
|
try {
|
|
156
168
|
const allLogs = await this.getLogs();
|
|
157
|
-
|
|
169
|
+
const logs = (allLogs.filter((log: any) => log.runId === runId) || []) as BaseLogMessage[];
|
|
170
|
+
return logs;
|
|
158
171
|
} catch (error) {
|
|
159
172
|
console.error('Error getting logs by runId from Upstash:', error);
|
|
160
173
|
return [] as BaseLogMessage[];
|
|
161
174
|
}
|
|
162
175
|
}
|
|
163
176
|
}
|
|
177
|
+
|