mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-29 17:55:24 +00:00
v4.6 -1 (#459)
This commit is contained in:
26
packages/service/common/mongo/controller.ts
Normal file
26
packages/service/common/mongo/controller.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
/* add logger */
|
||||
export const addLog = {
|
||||
info: (msg: string, obj?: Record<string, any>) => {
|
||||
global.logger?.info(msg, { meta: obj });
|
||||
},
|
||||
error: (msg: string, error?: any) => {
|
||||
global.logger?.error(msg, {
|
||||
meta: {
|
||||
stack: error?.stack,
|
||||
...(error?.config && {
|
||||
config: {
|
||||
headers: error.config.headers,
|
||||
url: error.config.url,
|
||||
data: error.config.data
|
||||
}
|
||||
}),
|
||||
...(error?.response && {
|
||||
response: {
|
||||
status: error.response.status,
|
||||
statusText: error.response.statusText
|
||||
}
|
||||
})
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
Reference in New Issue
Block a user