js/utils/old_logs.js
// var API = require('./logs_console');
import * as API_winston from './logs_winston'
import * as API_console from './logs_console'
const mw = API_winston
let API = {}
// API.enabled = true
API.enable_trace = function()
{
API.enabled = true
}
// mw.enable_trace = API.enable_trace
API.disable_trace = function()
{
API.enabled = false
}
// mw.disable_trace = API.disable_trace
API.get_trace = function()
{
return API.enabled
}
// mw.get_trace = API.get_trace
API.set_trace = function(arg_value)
{
API.enabled = arg_value
}
// mw.set_trace = API.set_trace
API.toggle_trace = function()
{
API.enabled = ! API.enabled
}
// mw.toggle_trace = API.toggle_trace
function should_trace(arg_level, arg_module)
{
return API.enabled ? API.enabled : false // && ! /executable_route/.test(arg_module)
}
// mw.should_trace = API.should_trace
API.should_trace = should_trace
API.debug = function(arg_module, arg_msg, arg_val_1, arg_val_2, arg_val_3)
{
if ( should_trace('debug', arg_module) )
{
mw.debug(arg_module, arg_msg, arg_val_1, arg_val_2, arg_val_3)
}
}
API.info = function(arg_module, arg_msg, arg_val_1, arg_val_2, arg_val_3)
{
if ( should_trace('info', arg_module) )
{
mw.info(arg_module, arg_msg, arg_val_1, arg_val_2, arg_val_3)
}
}
API.warn = function(arg_module, arg_msg, arg_val_1, arg_val_2, arg_val_3)
{
if ( should_trace('warn', arg_module) )
{
mw.warn(arg_module, arg_msg, arg_val_1, arg_val_2, arg_val_3)
}
}
API.error = function(arg_module, arg_msg)
{
if ( should_trace('error', arg_module) )
{
mw.error(arg_module, arg_msg)
}
}
module.exports = API
export default API