'use strict'; const _ = require('lodash'); const assert = require('assert'); const Base = require('./Base'); const consts = require('../constants'); const normalizeComponent = require('../common').normalizeComponent; class LoggerBse extends Base { constructor(logContext, category) { super(logContext, resolveCategory(category), consts.LOG_LEVELS, consts.DEFAULT_LEVELS.LOGGER); } getLevel() { const level = super.getLevel(); const iLevel = consts.ALL_LEVELS[level]; if (iLevel >= consts.LOG_LEVELS.info) { return level; } return consts.MOST_VERBOSE_LEVEL.LOGGER; } } Object.keys(consts.LOG_LEVELS).forEach(function (level) { LoggerBse.prototype[level] = function () { if (this.isEnabled(level)) { this._outputEntry(level, arguments); } }; }); function resolveCategory(category) { assert(_.isString(category), 'Category argument should be a string'); assert(/^\//.test(category), 'Category should start with a forward slash'); assert(!/\\/.test(category), 'Category should not contain back slashes'); return normalizeComponent(category); } module.exports = LoggerBse;