mirror of
https://github.com/labring/FastGPT.git
synced 2025-10-16 16:04:34 +00:00
feat: support signoz (#5218)
* feat: support signoz * chore: restructure otel
This commit is contained in:
@@ -3,6 +3,7 @@ import chalk from 'chalk';
|
||||
import { LogLevelEnum } from './log/constant';
|
||||
import { connectionMongo } from '../mongo/index';
|
||||
import { getMongoLog } from './log/schema';
|
||||
import { getLogger } from '../otel/log';
|
||||
|
||||
export enum EventTypeEnum {
|
||||
outLinkBot = '[Outlink bot]',
|
||||
@@ -10,6 +11,8 @@ export enum EventTypeEnum {
|
||||
wxOffiaccount = '[Offiaccount bot]'
|
||||
}
|
||||
|
||||
const logger = getLogger();
|
||||
|
||||
const logMap = {
|
||||
[LogLevelEnum.debug]: {
|
||||
levelLog: chalk.green('[Debug]')
|
||||
@@ -57,6 +60,17 @@ export const addLog = {
|
||||
|
||||
level === LogLevelEnum.error && console.error(obj);
|
||||
|
||||
if (logger) {
|
||||
logger.emit({
|
||||
severityNumber: level.valueOf(),
|
||||
severityText: ['debug', 'info', 'warn', 'error'][level],
|
||||
body: {
|
||||
msg,
|
||||
obj
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// store log
|
||||
if (level >= STORE_LOG_LEVEL && connectionMongo.connection.readyState === 1) {
|
||||
(async () => {
|
||||
|
Reference in New Issue
Block a user