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

87 lines
4.3 KiB
JavaScript
Raw 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-08-28 11:14:35 +00:00
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYmVhdXR5bG9nLmxvZy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL2JlYXV0eWxvZy5sb2cudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSwwQkFBdUI7QUFFdkIsbUVBQXFEO0FBRXJEOzs7O0dBSUc7QUFFUSxRQUFBLEdBQUcsR0FBRyxDQUFDLE9BQU87SUFDdkIsTUFBTSxDQUFDLG1DQUFXLENBQUMsS0FBSyxFQUFFLE9BQU8sQ0FBQyxDQUFBO0FBQ3BDLENBQUMsQ0FBQTtBQUVVLFFBQUEsSUFBSSxHQUFHLENBQUMsT0FBTztJQUN4Q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