smartlog-destination-local/dist/beautylog.log.js
2017-08-28 13:14:35 +02:00

87 lines
4.3 KiB
JavaScript

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
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);
};
/**
* note
*/
exports.note = (logText) => {
return beautylog_log_helpers_1.internalLog('note', 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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYmVhdXR5bG9nLmxvZy5qcyIsInNvdXJjZVJvb3Qi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