2016-05-02 00:23:40 +00:00
|
|
|
"use strict";
|
2016-05-23 07:10:30 +00:00
|
|
|
require("typings-global");
|
2016-07-23 17:47:23 +00:00
|
|
|
const beautylog_log_helpers_1 = require("./beautylog.log.helpers");
|
2016-05-02 00:23:40 +00:00
|
|
|
/**
|
|
|
|
* logs an info to console
|
|
|
|
* @param logText
|
|
|
|
* @returns {boolean}
|
|
|
|
*/
|
2016-07-23 23:17:38 +00:00
|
|
|
exports.log = (logText) => {
|
2016-10-16 00:26:43 +00:00
|
|
|
return beautylog_log_helpers_1.internalLog('log', logText);
|
2016-07-23 23:17:38 +00:00
|
|
|
};
|
2016-07-23 17:47:23 +00:00
|
|
|
exports.info = (logText) => {
|
2016-07-23 23:17:38 +00:00
|
|
|
return beautylog_log_helpers_1.internalLog('info', logText);
|
2016-05-02 00:23:40 +00:00
|
|
|
};
|
|
|
|
/**
|
|
|
|
* logs an 'OK!' message to console
|
|
|
|
* @param logText
|
|
|
|
* @returns {boolean}
|
|
|
|
*/
|
2016-07-23 17:47:23 +00:00
|
|
|
exports.ok = (logText) => {
|
2016-10-16 00:26:43 +00:00
|
|
|
return beautylog_log_helpers_1.internalLog('ok', logText);
|
2016-05-02 00:23:40 +00:00
|
|
|
};
|
|
|
|
/**
|
|
|
|
* logs a success to console
|
|
|
|
* @param logText string to log as error
|
|
|
|
* @returns {boolean}
|
|
|
|
*/
|
2016-07-23 17:47:23 +00:00
|
|
|
exports.success = (logText) => {
|
2016-10-16 00:26:43 +00:00
|
|
|
return beautylog_log_helpers_1.internalLog('success', logText);
|
2016-05-02 00:23:40 +00:00
|
|
|
};
|
|
|
|
/**
|
|
|
|
* logs a 'warn:' message to console
|
|
|
|
* @param logText string to log as error
|
|
|
|
* @returns {boolean}
|
|
|
|
*/
|
2016-07-23 17:47:23 +00:00
|
|
|
exports.warn = (logText) => {
|
2016-10-16 00:26:43 +00:00
|
|
|
return beautylog_log_helpers_1.internalLog('warn', logText);
|
2016-05-02 00:23:40 +00:00
|
|
|
};
|
|
|
|
/**
|
|
|
|
* logs an error to console
|
|
|
|
* @param logText
|
|
|
|
* @returns {boolean}
|
|
|
|
*/
|
2016-07-23 17:47:23 +00:00
|
|
|
exports.error = (logText) => {
|
2016-10-16 00:26:43 +00:00
|
|
|
return beautylog_log_helpers_1.internalLog('error', logText);
|
2016-05-02 00:23:40 +00:00
|
|
|
};
|
|
|
|
/**
|
|
|
|
* logs an directory to console
|
|
|
|
* @param logText
|
|
|
|
* @returns {boolean}
|
|
|
|
*/
|
2016-07-23 17:47:23 +00:00
|
|
|
exports.dir = (logText) => {
|
2016-10-16 00:26:43 +00:00
|
|
|
return beautylog_log_helpers_1.internalLog('dir', logText);
|
2016-05-02 00:23:40 +00:00
|
|
|
};
|
2017-01-21 22:12:39 +00:00
|
|
|
/**
|
|
|
|
* note
|
|
|
|
*/
|
|
|
|
exports.note = (logText) => {
|
|
|
|
return beautylog_log_helpers_1.internalLog('note', logText);
|
|
|
|
};
|
2016-06-16 21:57:49 +00:00
|
|
|
/**
|
|
|
|
* creates a new empty line
|
|
|
|
* @param linesArg
|
|
|
|
* @returns void
|
|
|
|
*/
|
2016-07-23 17:47:23 +00:00
|
|
|
exports.newLine = (linesArg = 1) => {
|
|
|
|
for (let i = 0; i < linesArg; i++) {
|
2016-10-16 00:26:43 +00:00
|
|
|
console.log('\n');
|
2016-06-16 00:17:28 +00:00
|
|
|
}
|
|
|
|
};
|
2016-06-16 21:57:49 +00:00
|
|
|
/**
|
|
|
|
* logs a reduced log that only logs changes of consequential log messages
|
|
|
|
*/
|
2016-07-23 17:47:23 +00:00
|
|
|
exports.logReduced = (logTextArg, repeatEveryTimesArg = 0) => {
|
2017-01-21 00:05:28 +00:00
|
|
|
if (logTextArg === previousMessage && (repeatEveryTimesArg === 0 || sameMessageCounter !== repeatEveryTimesArg)) {
|
2016-06-16 21:57:49 +00:00
|
|
|
sameMessageCounter++;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
sameMessageCounter = 0;
|
|
|
|
previousMessage = logTextArg;
|
2016-07-23 23:17:38 +00:00
|
|
|
exports.log(logTextArg);
|
2016-06-16 21:57:49 +00:00
|
|
|
}
|
|
|
|
};
|
2016-10-16 00:26:43 +00:00
|
|
|
let previousMessage = '';
|
2016-07-23 17:47:23 +00:00
|
|
|
let sameMessageCounter = 0;
|
2017-01-21 22:12:39 +00:00
|
|
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYmVhdXR5bG9nLmxvZy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL2JlYXV0eWxvZy5sb2cudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLDBCQUF1QjtBQUV2QixtRUFBbUQ7QUFFbkQ7Ozs7R0FJRztBQUVRLFFBQUEsR0FBRyxHQUFHLENBQUMsT0FBTztJQUNyQixNQUFNLENBQUMsbUNBQVcsQ0FBQyxLQUFLLEVBQUMsT0FBTyxDQUFDLENBQUE7QUFDckMsQ0FBQyxDQUFBO0FBRVUsUUFBQSxJQUFJLEdBQUcsQ0FBQyxPQUFPO0lBQ3RCLE1BQU0sQ0FBQyxtQ0FBVyxDQUFDLE1BQU0sRUFBQyxPQUFPLENBQUMsQ0FBQTtBQUN0QyxDQUFDLENBQUE7QUFFRDs7OztHQUlHO0FBQ1EsUUFBQSxFQUFFLEdBQUcsQ0FBQyxPQUFPO0lBQ3BCLE1BQU0sQ0FBQyxtQ0FBVyxDQUFDLElBQUksRUFBQyxPQUFPLENBQUMsQ0FBQTtBQUNwQyxDQUFDLENBQUE7QUFFRDs7OztHQUlHO0FBQ1EsUUFBQSxPQUFPLEdBQUcsQ0FBQyxPQUFPO0lBQ3pCLE1BQU0sQ0FBQyxtQ0FBVyxDQUFDLFNBQVMsRUFBQyxPQUFPLENBQUMsQ0FBQTtBQUN6QyxDQUFDLENBQUE7QUFFRDs7OztHQUlHO0FBQ1EsUUFBQSxJQUFJLEdBQUcsQ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