@mischback/buster
Version:
buster is a tool to support cache busting for static assets of a website.
50 lines • 1.84 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.suppressLogOutput = exports.applyUserConfiguration = exports.applyDebugConfiguration = exports.applyLoggingConfiguration = exports.logger = void 0;
const tslog_1 = require("tslog");
const debugLoggingConfiguration = {
minLevel: "debug",
displayFunctionName: true,
displayFilePath: "hideNodeModulesOnly",
printLogMessageInNewLine: true,
suppressStdOutput: false,
};
const defaultLoggingConfiguration = {
name: "buster",
displayLoggerName: true,
minLevel: "info",
displayFunctionName: false,
displayFilePath: "hidden",
};
exports.logger = new tslog_1.Logger(defaultLoggingConfiguration);
function applyLoggingConfiguration(loggingConfig) {
exports.logger.setSettings(loggingConfig);
}
exports.applyLoggingConfiguration = applyLoggingConfiguration;
function applyDebugConfiguration() {
applyLoggingConfiguration(debugLoggingConfiguration);
exports.logger.debug("Activated debug mode...");
}
exports.applyDebugConfiguration = applyDebugConfiguration;
function applyUserConfiguration(loggingConfig, debug) {
resetLoggingConfiguration();
applyLoggingConfiguration(loggingConfig);
if (debug === true)
exports.logger.setSettings({ minLevel: "debug" });
}
exports.applyUserConfiguration = applyUserConfiguration;
function resetLoggingConfiguration() {
exports.logger.setSettings({
displayFunctionName: true,
displayLoggerName: true,
displayFilePath: "hideNodeModulesOnly",
minLevel: "silly",
printLogMessageInNewLine: false,
suppressStdOutput: false,
});
}
function suppressLogOutput() {
exports.logger.setSettings({ suppressStdOutput: true });
}
exports.suppressLogOutput = suppressLogOutput;
//# sourceMappingURL=logging.js.map