mirror of
https://gitlab.com/MrFry/mrfrys-node-server
synced 2025-04-01 20:24:18 +02:00
logger ability to disable all logs, rmduplicates logger disabling
This commit is contained in:
@@ -46,9 +46,14 @@ let dvData = {} // visit data, but daily
|
||||
let uvData = {} // visit data, but per user
|
||||
let udvData = {} // visit data, but per user and daily
|
||||
let writes = 0
|
||||
let loggingDisabled = false
|
||||
|
||||
let noLogIds: string[] = []
|
||||
|
||||
function setLoggingDisabled(newVal: boolean): void {
|
||||
loggingDisabled = newVal
|
||||
}
|
||||
|
||||
function getColoredDateString(): string {
|
||||
const date = new Date()
|
||||
const dateString = utils.GetDateString()
|
||||
@@ -81,7 +86,7 @@ function Log(msg: string | object, color?: string): void {
|
||||
log = getColoredDateString() + delimiter + C(color) + msg + C()
|
||||
}
|
||||
|
||||
if (!process.env.NS_NOLOG) {
|
||||
if (!process.env.NS_NOLOG && !loggingDisabled) {
|
||||
console.log(log)
|
||||
}
|
||||
utils.AppendToFile(
|
||||
@@ -423,4 +428,5 @@ export default {
|
||||
logFileName: logFileName,
|
||||
logDir: logDir,
|
||||
vlogDir: vlogDir,
|
||||
setLoggingDisabled: setLoggingDisabled,
|
||||
}
|
||||
|
Reference in New Issue
Block a user