mirror of
https://gitlab.com/MrFry/mrfrys-node-server
synced 2025-04-01 20:24:18 +02:00
debug log deprecation
This commit is contained in:
parent
dea75c6bf5
commit
4bb8059986
3 changed files with 4 additions and 18 deletions
|
@ -193,7 +193,6 @@ Set these before launching the server (`VAR="" npm run start`)
|
|||
| DOMAIN | string | The domain that the server should use for redirects, cookies, etc. ex.: `qmining.com`, without 'https://', and '/'-s. If not specified `./data/domain` will be used |
|
||||
| NS_NO_HTTPS_FORCE | boolean | Disables automatic redirects from http to https |
|
||||
| NS_THREAD_COUNT | number | Nubmer of CPU cores to use |
|
||||
| NS_LOGLEVEL | number | Debug log level, 0 is the least verbose |
|
||||
| NS_SQL_DEBUG_LOG | boolean | If the SQL queries should be logged |
|
||||
| NS_NOUSER | boolean | If the authorization should be skipped (for testing) |
|
||||
| NS_NOLOG | boolean | If logging should be skipped |
|
||||
|
|
|
@ -74,7 +74,9 @@ function createDefaultUser(userDb: Database) {
|
|||
created: new Date().getTime(),
|
||||
})
|
||||
logger.Log('ID and PW for user #1: ', 'yellowbg')
|
||||
console.log()
|
||||
console.log(`ID: #${insertRes.lastInsertRowid}, PW: "${pw}"`)
|
||||
console.log()
|
||||
logger.Log('It can be also viewed in the users db file.')
|
||||
}
|
||||
|
||||
|
|
|
@ -33,7 +33,6 @@ const logFileName = 'log'
|
|||
|
||||
// TODO: on process exit write all
|
||||
const writeInterval = 10
|
||||
const debugLevel = parseInt(process.env.NS_LOGLEVEL) || 0
|
||||
|
||||
let vData = {} // visit data
|
||||
let dvData = {} // visit data, but daily
|
||||
|
@ -55,22 +54,8 @@ function getColoredDateString(): string {
|
|||
}
|
||||
|
||||
function DebugLog(msg: string | object, name: string, lvl: number): void {
|
||||
if (lvl <= debugLevel) {
|
||||
if (msg === 'hr') {
|
||||
msg = hr
|
||||
}
|
||||
let res = msg
|
||||
const header = `${C('red')}#DEBUG${lvl}#${C(
|
||||
'yellow'
|
||||
)}${name.toUpperCase()}${C('red')}#${C()}${DELIM}${C()}`
|
||||
if (typeof msg !== 'object') {
|
||||
res = header + msg
|
||||
} else {
|
||||
Log(header + 'OBJECT:', 'yellow')
|
||||
res = msg
|
||||
}
|
||||
Log(res, 'yellow')
|
||||
}
|
||||
console.warn('deprecated')
|
||||
console.log(msg, name, lvl)
|
||||
}
|
||||
|
||||
function Log(msg: string | object, color?: string): void {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue