Example #1
0
function logAjaxRequest(type, url, count, data) {
    const withData = (data !== null && data !== undefined);

    const groupLogger = logger.group(`${type} ${url}`);

    groupLogger.start();

    groupLogger.log(`%c AJAX ${type} call: ${url}${withData ? ' with request: ' : ''}`, 'color: blue;');
    withData && groupLogger.log(data);
    groupLogger.time(`${count} : ${url}`);
}
Example #2
0
function logAjaxResponse(type, url, count, response) {
    const hasResponse = (response !== null) && (response !== undefined) && (response !== ''); // false and 0 is legal

    const groupLogger = logger.group(`${type} ${url}`);

    groupLogger.timeEnd(`${count} : ${url}`);
    groupLogger.log(`%c AJAX ${type} call done: ${url}${hasResponse ? ' response: ' : ''}`, 'color: green;');
    hasResponse && groupLogger.log(response);

    groupLogger.finish();
}