-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
2,515 additions
and
2,426 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
'@alita/plugin-azure': patch | ||
'alita': patch | ||
--- | ||
|
||
feat: add aigc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import fs from 'fs'; | ||
import readline from 'readline'; | ||
import stream from 'stream'; | ||
|
||
export const getPinoLogByLevel = async ( | ||
lever: number, | ||
path: string, | ||
): Promise<any[]> => { | ||
return new Promise((resolve, reject) => { | ||
// 创建读取和写入的streams | ||
const instream = fs.createReadStream(path); | ||
const outstream = new stream(); | ||
// @ts-ignore | ||
const rl = readline.createInterface(instream, outstream); | ||
|
||
let errorLogs: any[] = []; | ||
|
||
rl.on('line', function (line) { | ||
// 将每一行转换成 JSON 对象 | ||
let logObject = JSON.parse(line); | ||
|
||
// 检查日志等级是否为 'error' | ||
if (logObject.level === lever) { | ||
errorLogs.push(logObject); | ||
} | ||
}); | ||
|
||
rl.on('close', function () { | ||
resolve(errorLogs); | ||
}); | ||
rl.on('error', (e) => { | ||
console.error('读取日志文件错误', path); | ||
reject(e); | ||
}); | ||
}); | ||
}; |
Oops, something went wrong.