775ac7b58c
you must login with an BTP account in order to see the app
27 lines
665 B
JavaScript
27 lines
665 B
JavaScript
'use strict';
|
|
|
|
const _ = require('lodash');
|
|
const assert = require('assert');
|
|
const path = require('path');
|
|
|
|
const consts = require('./constants');
|
|
|
|
module.exports = {
|
|
normalizeComponent,
|
|
normalizeLevel
|
|
};
|
|
|
|
function normalizeComponent(component) {
|
|
const shortComponent = component.replace(process.env.HOME, '');
|
|
const isFilePath = shortComponent !== component;
|
|
if (isFilePath && path.sep === '\\') {
|
|
return shortComponent.replace(/\\/g, '/');
|
|
}
|
|
return shortComponent;
|
|
}
|
|
|
|
function normalizeLevel(level) {
|
|
level = level.toLowerCase();
|
|
assert(_.isNumber(consts.ALL_LEVELS[level]), 'Logging level not among the allowed values');
|
|
return level;
|
|
}
|