mirror of
https://github.com/tribufu/node-gamedig
synced 2026-06-01 09:42:41 +00:00
Improve multi-attempt logging
This commit is contained in:
parent
ab6e9064d2
commit
dd5dce21db
3 changed files with 34 additions and 42 deletions
|
|
@ -3,6 +3,7 @@ const HexUtil = require('./HexUtil');
|
|||
class Logger {
|
||||
constructor() {
|
||||
this.debugEnabled = false;
|
||||
this.prefix = '';
|
||||
}
|
||||
|
||||
debug(...args) {
|
||||
|
|
@ -14,6 +15,9 @@ class Logger {
|
|||
try {
|
||||
const strings = this._convertArgsToStrings(...args);
|
||||
if (strings.length) {
|
||||
if (this.prefix) {
|
||||
strings.unshift(this.prefix);
|
||||
}
|
||||
console.log(...strings);
|
||||
}
|
||||
} catch(e) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue