smartlog-destination-local/dist/beautylog.log.js
2017-03-11 12:30:18 +01: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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