mirror of
https://github.com/Kuingsmile/PicList.git
synced 2026-06-01 10:09:37 +08:00
✨ Feature: add tencent-cos options for url
ISSUES CLOSED: #862, #863, #865, #524, #845, #732
This commit is contained in:
@@ -9,14 +9,23 @@ const LOG_PATH = path.join(STORE_PATH, '/picgo.log')
|
||||
// since the error may occur in picgo-core
|
||||
// so we can't use the log from picgo
|
||||
export const loggerWriter = (error: Error) => {
|
||||
let log = `${dayjs().format('YYYY-MM-DD HH:mm:ss')} [PicGo ERROR] startup error`
|
||||
if (error?.stack) {
|
||||
log += `\n------Error Stack Begin------\n${util.format(error.stack)}\n-------Error Stack End-------\n`
|
||||
} else {
|
||||
const msg = JSON.stringify(error)
|
||||
log += `${msg}\n`
|
||||
try {
|
||||
const time = dayjs().format('YYYY-MM-DD HH:mm:ss')
|
||||
let log = `${time} [PicGo ERROR] process error begin`
|
||||
if (error?.stack) {
|
||||
log += `\n------Error Stack Begin------\n${util.format(error.stack)}\n-------Error Stack End-------\n`
|
||||
} else {
|
||||
const msg = JSON.stringify(error)
|
||||
log += `${msg}\n`
|
||||
}
|
||||
log += `${time} [PicGo ERROR] process error end`
|
||||
if (!fse.existsSync(LOG_PATH)) {
|
||||
fse.ensureFileSync(LOG_PATH)
|
||||
}
|
||||
fse.appendFileSync(LOG_PATH, log)
|
||||
} catch (e) {
|
||||
console.error(e)
|
||||
}
|
||||
fse.appendFileSync(LOG_PATH, log)
|
||||
}
|
||||
|
||||
const handleProcessError = (error: Error) => {
|
||||
|
||||
Reference in New Issue
Block a user