smartlog-destination-local/dist/beautylog.log.js
2017-01-21 01:05:28 +01:00

80 lines
3.9 KiB
JavaScript

"use strict";
require("typings-global");
const beautylog_log_helpers_1 = require("./beautylog.log.helpers");
/**
* logs an info to console
* @param logText
* @returns {boolean}
*/
exports.log = (logText) => {
return beautylog_log_helpers_1.internalLog('log', logText);
};
exports.info = (logText) => {
return beautylog_log_helpers_1.internalLog('info', logText);
};
/**
* logs an 'OK!' message to console
* @param logText
* @returns {boolean}
*/
exports.ok = (logText) => {
return beautylog_log_helpers_1.internalLog('ok', logText);
};
/**
* logs a success to console
* @param logText string to log as error
* @returns {boolean}
*/
exports.success = (logText) => {
return beautylog_log_helpers_1.internalLog('success', logText);
};
/**
* logs a 'warn:' message to console
* @param logText string to log as error
* @returns {boolean}
*/
exports.warn = (logText) => {
return beautylog_log_helpers_1.internalLog('warn', logText);
};
/**
* logs an error to console
* @param logText
* @returns {boolean}
*/
exports.error = (logText) => {
return beautylog_log_helpers_1.internalLog('error', logText);
};
/**
* logs an directory to console
* @param logText
* @returns {boolean}
*/
exports.dir = (logText) => {
return beautylog_log_helpers_1.internalLog('dir', logText);
};
/**
* 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;
exports.log(logTextArg);
}
};
let previousMessage = '';
let sameMessageCounter = 0;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYmVhdXR5bG9nLmxvZy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL2JlYXV0eWxvZy5sb2cudHMiXSwibmFtZXMiOltdLCJtYXB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