mirror of
https://github.com/filiprojek/nork.git
synced 2024-11-23 17:21:02 +01:00
Compare commits
No commits in common. "cbf56b54c1cf73f6d79490bdd8763f66a1c253ca" and "ae5ceb643f149987e460307db956ed47ead801b8" have entirely different histories.
cbf56b54c1
...
ae5ceb643f
@ -3,32 +3,21 @@ import fs from 'fs'
|
|||||||
import path from 'path'
|
import path from 'path'
|
||||||
|
|
||||||
export default class Log {
|
export default class Log {
|
||||||
public static info(code: number, message: string, data?: any): object {
|
|
||||||
if (!data) {
|
|
||||||
data = ''
|
|
||||||
}
|
|
||||||
|
|
||||||
|
public static info(code: number, message: string, data?:any): void {
|
||||||
|
if(!data) {
|
||||||
|
data = ""
|
||||||
|
}
|
||||||
console.log(colors.bgGreen.black(` ${code} `) + colors.green.bgBlack(` ${message} `) + data)
|
console.log(colors.bgGreen.black(` ${code} `) + colors.green.bgBlack(` ${message} `) + data)
|
||||||
//this.writeLog('info', code, message, data)
|
|
||||||
return {
|
|
||||||
code: code,
|
|
||||||
message: message,
|
|
||||||
data: data
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static error(code: number, message: string, data?: any): object {
|
public static error(code: number, message: string, data?:any): void {
|
||||||
if(!data) {
|
if(!data) {
|
||||||
data = ''
|
data = ""
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(colors.bgRed.black(` ${code} `) + colors.red.bgBlack(` ${message} `) + data)
|
console.log(colors.bgRed.black(` ${code} `) + colors.red.bgBlack(` ${message} `) + data)
|
||||||
//this.writeLog('error', code, message, data)
|
//this.writeLog('error', code, message, data)
|
||||||
return {
|
|
||||||
code: code,
|
|
||||||
message: message,
|
|
||||||
data: data
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
private static writeLog(level: string, code: number, message: string, data?:any): void {
|
private static writeLog(level: string, code: number, message: string, data?:any): void {
|
||||||
if(data) {
|
if(data) {
|
||||||
@ -36,10 +25,11 @@ export default class Log {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
throw Error('nevim')
|
throw Error("nevim")
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.error(500, 'Error while writing to log file', error)
|
this.error(500, 'Error while writing to log file', error)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user