mirror of
https://gitlab.com/MrFry/mrfrys-node-server
synced 2025-04-01 20:24:18 +02:00
logging fix
This commit is contained in:
parent
e1747b9b11
commit
ab33a2e059
2 changed files with 4 additions and 2 deletions
|
@ -511,7 +511,7 @@ function addQuestion(
|
||||||
logger.DebugLog('Adding new question to existing subject', 'qdb add', 1)
|
logger.DebugLog('Adding new question to existing subject', 'qdb add', 1)
|
||||||
data[i].Questions.push(question)
|
data[i].Questions.push(question)
|
||||||
} else {
|
} else {
|
||||||
logger.Log(`Creating new subject: ${subj}`)
|
logger.Log(`Creating new subject: "${subj}"`)
|
||||||
data.push({
|
data.push({
|
||||||
Name: subj,
|
Name: subj,
|
||||||
Questions: [question],
|
Questions: [question],
|
||||||
|
|
|
@ -80,13 +80,15 @@ function DebugLog(msg: string | object, name: string, lvl: number): void {
|
||||||
}
|
}
|
||||||
|
|
||||||
function Log(msg: string | object, color?: string): void {
|
function Log(msg: string | object, color?: string): void {
|
||||||
|
if (loggingDisabled) return
|
||||||
|
|
||||||
let log = msg
|
let log = msg
|
||||||
if (typeof msg !== 'object') {
|
if (typeof msg !== 'object') {
|
||||||
const delimiter = DELIM + C(color)
|
const delimiter = DELIM + C(color)
|
||||||
log = getColoredDateString() + delimiter + C(color) + msg + C()
|
log = getColoredDateString() + delimiter + C(color) + msg + C()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!process.env.NS_NOLOG && !loggingDisabled) {
|
if (!process.env.NS_NOLOG) {
|
||||||
console.log(log)
|
console.log(log)
|
||||||
}
|
}
|
||||||
utils.AppendToFile(
|
utils.AppendToFile(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue