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

87 lines
4.3 KiB
JavaScript
Raw Permalink Normal View History

2016-05-02 00:23:40 +00:00
"use strict";
2017-03-11 11:30:18 +00:00
Object.defineProperty(exports, "__esModule", { value: true });
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-03-11 11:30:18 +00:00
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYmVhdXR5bG9nLmxvZy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL2JlYXV0eWxvZy5sb2cudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSwwQkFBdUI7QUFFdkIsbUVBQW1EO0FBRW5EOzs7O0dBSUc7QUFFUSxRQUFBLEdBQUcsR0FBRyxDQUFDLE9BQU87SUFDckIsTUFBTSxDQUFDLG1DQUFXLENBQUMsS0FBSyxFQUFDLE9BQU8sQ0FBQyxDQUFBO0FBQ3JDLENBQUMsQ0FBQTtBQUVVLFFBQUEsSUFBSSxHQUFHLENBQUMsT0FBTztJQU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