logging fix

This commit is contained in:
mrfry 2023-03-08 08:42:33 +01:00
parent e1747b9b11
commit ab33a2e059
2 changed files with 4 additions and 2 deletions

View file

@ -511,7 +511,7 @@ function addQuestion(
logger.DebugLog('Adding new question to existing subject', 'qdb add', 1)
data[i].Questions.push(question)
} else {
logger.Log(`Creating new subject: ${subj}`)
logger.Log(`Creating new subject: "${subj}"`)
data.push({
Name: subj,
Questions: [question],

View file

@ -80,13 +80,15 @@ function DebugLog(msg: string | object, name: string, lvl: number): void {
}
function Log(msg: string | object, color?: string): void {
if (loggingDisabled) return
let log = msg
if (typeof msg !== 'object') {
const delimiter = DELIM + C(color)
log = getColoredDateString() + delimiter + C(color) + msg + C()
}
if (!process.env.NS_NOLOG && !loggingDisabled) {
if (!process.env.NS_NOLOG) {
console.log(log)
}
utils.AppendToFile(