smartlog-destination-local/dist/beautylog.log.js

79 lines
3.8 KiB
JavaScript

"use strict";
require("typings-global");
const beautylog_log_helpers_1 = require("./beautylog.log.helpers");
var beautylog_log_helpers_2 = require("./beautylog.log.helpers");
exports.log = beautylog_log_helpers_2.log;
/**
* logs an info to console
* @param logText
* @returns {boolean}
*/
exports.info = (logText) => {
return beautylog_log_helpers_1.log(logText, 'info');
};
/**
* logs an 'OK!' message to console
* @param logText
* @returns {boolean}
*/
exports.ok = (logText) => {
return beautylog_log_helpers_1.log(logText, 'ok');
};
/**
* logs a success to console
* @param logText string to log as error
* @returns {boolean}
*/
exports.success = (logText) => {
return beautylog_log_helpers_1.log(logText, 'success');
};
/**
* logs a 'warn:' message to console
* @param logText string to log as error
* @returns {boolean}
*/
exports.warn = (logText) => {
return beautylog_log_helpers_1.log(logText, 'warn');
};
/**
* logs an error to console
* @param logText
* @returns {boolean}
*/
exports.error = (logText) => {
return beautylog_log_helpers_1.log(logText, 'error');
};
/**
* logs an directory to console
* @param logText
* @returns {boolean}
*/
exports.dir = (logText) => {
return beautylog_log_helpers_1.log(logText, 'dir');
};
/**
* creates a new empty line
* @param linesArg
* @returns void
*/
exports.newLine = (linesArg = 1) => {
for (let i = 0; i < linesArg; i++) {
console.log("\n");
}
};
/**
* logs a reduced log that only logs changes of consequential log messages
*/
exports.logReduced = (logTextArg, repeatEveryTimesArg = 0) => {
if (logTextArg == previousMessage && (repeatEveryTimesArg == 0 || sameMessageCounter != repeatEveryTimesArg)) {
sameMessageCounter++;
}
else {
sameMessageCounter = 0;
previousMessage = logTextArg;
beautylog_log_helpers_1.log(logTextArg);
}
};
let previousMessage = "";
let sameMessageCounter = 0;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYmVhdXR5bG9nLmxvZy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL2JlYXV0eWxvZy5sb2cudHMiXSwibmFtZXMiOltdLCJtYXBwaW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