Commit 00f11149 authored by JC Brand's avatar JC Brand

Include timestamps in debug logs

parent f73075d2
......@@ -4,6 +4,7 @@
### Bugfixes
- Don't require `auto_login` to be `true` when using the API to log in.
- Moment locale wasn't being set to the value passed via the `i18n` option.
### New Features
- #828 Add routing for the `#converse-login` and `#converse-register` URL
......
......@@ -155,27 +155,35 @@
}, console);
if (level === Strophe.LogLevel.ERROR) {
if (_converse.debug) {
logger.trace(`ERROR: ${message}`);
logger.trace(`${moment().format()} ERROR: ${message}`);
} else {
logger.error(`ERROR: ${message}`);
}
} else if (level === Strophe.LogLevel.WARN) {
if (_converse.debug) {
logger.warn(`${moment().format()} WARNING: ${message}`);
} else {
logger.warn(`WARNING: ${message}`);
}
} else if (level === Strophe.LogLevel.FATAL) {
if (_converse.debug) {
logger.trace(`FATAL: ${message}`);
logger.trace(`${moment().format()} FATAL: ${message}`);
} else {
logger.error(`FATAL: ${message}`);
}
} else if (_converse.debug) {
if (level === Strophe.LogLevel.DEBUG) {
logger.debug(`DEBUG: ${message}`);
logger.debug(`${moment().format()} DEBUG: ${message}`);
} else {
logger.info(`INFO: ${message}`);
logger.info(`${moment().format()} INFO: ${message}`);
}
}
};
Strophe.log = function (level, msg) { _converse.log(level+' '+msg, level); };
Strophe.error = function (msg) { _converse.log(msg, Strophe.LogLevel.ERROR); };
_converse.__ = function (str) {
/* Translate the given string based on the current locale.
*
......@@ -250,10 +258,6 @@
unloadevent = 'unload';
}
// Logging
Strophe.log = function (level, msg) { _converse.log(level+' '+msg, level); };
Strophe.error = function (msg) { _converse.log(msg, Strophe.LogLevel.ERROR); };
// Instance level constants
this.TIMEOUTS = { // Set as module attr so that we can override in tests.
'PAUSED': 10000,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment