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

83 lines
6.5 KiB
JavaScript
Raw Normal View History

2016-05-02 00:23:40 +00:00
"use strict";
2016-05-23 07:10:30 +00:00
require("typings-global");
2016-05-02 00:23:40 +00:00
var 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 = function (logText) {
return beautylog_log_helpers_1.log(logText, 'info');
};
/**
* logs an 'OK!' message to console
* @param logText
* @returns {boolean}
*/
exports.ok = function (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 = function (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 = function (logText) {
return beautylog_log_helpers_1.log(logText, 'warn');
};
/**
* logs an error to console
* @param logText
* @returns {boolean}
*/
exports.error = function (logText) {
return beautylog_log_helpers_1.log(logText, 'error');
};
/**
* logs an directory to console
* @param logText
* @returns {boolean}
*/
exports.dir = function (logText) {
return beautylog_log_helpers_1.log(logText, 'dir');
};
2016-06-16 21:57:49 +00:00
/**
* creates a new empty line
* @param linesArg
* @returns void
*/
2016-06-16 00:17:28 +00:00
exports.newLine = function (linesArg) {
if (linesArg === void 0) { linesArg = 1; }
for (var i = 0; i < linesArg; i++) {
console.log("\n");
}
};
2016-06-16 21:57:49 +00:00
/**
* logs a reduced log that only logs changes of consequential log messages
*/
exports.logReduced = function (logTextArg, repeatEveryTimesArg) {
if (repeatEveryTimesArg === void 0) { repeatEveryTimesArg = 0; }
if (logTextArg == previousMessage && (repeatEveryTimesArg == 0 || sameMessageCounter != repeatEveryTimesArg)) {
sameMessageCounter++;
}
else {
sameMessageCounter = 0;
previousMessage = logTextArg;
beautylog_log_helpers_1.log(logTextArg);
}
};
var previousMessage = "";
var sameMessageCoun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