jy-safe-app/utils/error.js
2025-10-14 15:17:30 +08:00

19 lines
462 B
JavaScript

import { formatTime } from './common'
/**
*
* @param {string} name 错误名字
* @param {string} action 错误动作描述
* @param {string} info 错误信息,通常是 fail 返回的
*/
// eslint-disable-next-line
export const logError = (name, action, info ) => {
if (!info) {
info = 'empty'
}
let time = formatTime(new Date())
console.error(time, name, action, info)
if (typeof info === 'object') {
info = JSON.stringify(info)
}
}