mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-23 21:13:50 +00:00
V4.6.6-2 (#673)
This commit is contained in:
@@ -4,11 +4,13 @@ import dayjs from 'dayjs';
|
||||
export const addLog = {
|
||||
log(level: 'info' | 'warn' | 'error', msg: string, obj: Record<string, any> = {}) {
|
||||
console.log(
|
||||
`[${level.toLocaleUpperCase()}] ${dayjs().format(
|
||||
'YYYY-MM-DD HH:mm:ss'
|
||||
)} ${msg}: ${JSON.stringify(obj)}`
|
||||
`[${level.toLocaleUpperCase()}] ${dayjs().format('YYYY-MM-DD HH:mm:ss')} ${msg} ${
|
||||
level !== 'error' ? JSON.stringify(obj) : ''
|
||||
}`
|
||||
);
|
||||
|
||||
level === 'error' && console.error(obj);
|
||||
|
||||
const lokiUrl = process.env.LOKI_LOG_URL as string;
|
||||
if (!lokiUrl) return;
|
||||
|
||||
|
Reference in New Issue
Block a user