mice-log
Version:
logging component - mice style
22 lines (21 loc) • 720 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getInitLevels = void 0;
const MICE_LOG_KNOWN_PREFIX = 'mice_log_';
const withSettings = (settings) => (a, b) => {
if (b.toLocaleLowerCase().startsWith(MICE_LOG_KNOWN_PREFIX)) {
const value = settings[b];
if (typeof value === 'string') {
a.set(b.substring(MICE_LOG_KNOWN_PREFIX.length).toLocaleLowerCase(), value);
}
}
return a;
};
const loadFrom = (settings) => Object
.keys(settings)
.reduce(withSettings(settings), new Map());
const getInitLevels = () => ({
basePath: './',
levels: loadFrom(process.env),
});
exports.getInitLevels = getInitLevels;