amazon-modern-widgets
Version:
Amazon Modern Widgets for Amazon affiliate websites based on Amazon PAAPI v5
47 lines • 1.54 kB
JavaScript
;
/**
* Logger configuration
* ----------------------------------------------
* Amazon Modern Widgets (AMW).
*
* @author : Ludovic Toinel <ludovic@toinel.com>
* @src : https://github.com/ltoinel/amw
*/
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.getLogger = getLogger;
const typescript_logging_1 = require("typescript-logging");
const typescript_logging_log4ts_style_1 = require("typescript-logging-log4ts-style");
const config_1 = __importDefault(require("config"));
// Debug the API calls
let defaultLogLevel = typescript_logging_1.LogLevel.Info;
// If the debug is enabled, we log everything on debug
if (config_1.default.get('Server.debug')) {
defaultLogLevel = typescript_logging_1.LogLevel.Debug;
}
const provider = typescript_logging_log4ts_style_1.Log4TSProvider.createProvider("AMW", {
groups: [
{
expression: new RegExp("AmwServer"),
level: defaultLogLevel,
},
{
expression: new RegExp("AmwApi"),
level: defaultLogLevel,
},
{
expression: new RegExp("Paapi"),
level: defaultLogLevel,
},
{
expression: new RegExp(".+"),
level: typescript_logging_1.LogLevel.Info,
},
]
});
function getLogger(name) {
return provider.getLogger(name);
}
//# sourceMappingURL=ConfigLog4j.js.map