mirror of
https://github.com/labring/laf.git
synced 2026-02-01 16:57:03 +00:00
fix: fix missing of console.warn/debug/info (#289)
This commit is contained in:
parent
861789c142
commit
2c2d4baecf
@ -2,21 +2,35 @@ import * as util from 'util'
|
||||
import * as dayjs from 'dayjs'
|
||||
|
||||
export class FunctionConsole {
|
||||
private _logs: any[] = []
|
||||
private _logs: string[] = []
|
||||
|
||||
get logs() {
|
||||
return this._logs
|
||||
}
|
||||
|
||||
log(...params: any[]) {
|
||||
private _log(...params: any[]) {
|
||||
const date = dayjs().format("YYYY/MM/DD HH:mm:ss")
|
||||
const r = util.format("[%s] -", date, ...params)
|
||||
this._logs.push(r)
|
||||
}
|
||||
|
||||
error(...params: any[]) {
|
||||
const date = dayjs().format("YYYY/MM/DD HH:mm:ss")
|
||||
const r = util.format("[%s] -", date, ...params)
|
||||
this._logs.push(r)
|
||||
debug(...params: any[]) {
|
||||
this._log(...params)
|
||||
}
|
||||
}
|
||||
|
||||
info(...params: any[]) {
|
||||
this._log(...params)
|
||||
}
|
||||
|
||||
log(...params: any[]) {
|
||||
this._log(...params)
|
||||
}
|
||||
|
||||
warn(...params: any[]) {
|
||||
this._log(...params)
|
||||
}
|
||||
|
||||
error(...params: any[]) {
|
||||
this._log(...params)
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user