summaryrefslogtreecommitdiffstats
path: root/packages/wekan-ldap/server/logger.js
blob: afd77112e4054d1820c04a48a2a4e422046d641d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
const isLogEnabled = (process.env.LDAP_LOG_ENABLED === 'true');


function log (level, message, data) { 
    if (isLogEnabled) {
        console.log(`[${level}] ${message} ${ data ? JSON.stringify(data, null, 2) : '' }`);
    }
}

function log_debug (...args) { log('DEBUG', ...args); }
function log_info (...args) { log('INFO', ...args); }
function log_warn (...args) { log('WARN', ...args); }
function log_error (...args) { log('ERROR', ...args); }

export { log, log_debug, log_info, log_warn, log_error };