add .logReduced, closes #2

This commit is contained in:
Philipp Kunz 2016-06-16 23:57:49 +02:00
parent da44542100
commit 6907a72f0b
8 changed files with 77 additions and 6 deletions

View File

@ -36,4 +36,13 @@ export declare let error: (logText: any) => void;
* @returns {boolean}
*/
export declare let dir: (logText: any) => void;
/**
* creates a new empty line
* @param linesArg
* @returns void
*/
export declare let newLine: (linesArg?: number) => void;
/**
* logs a reduced log that only logs changes of consequential log messages
*/
export declare let logReduced: (logTextArg: string, repeatEveryTimesArg?: number) => void;

23
dist/beautylog.log.js vendored
View File

@ -51,11 +51,32 @@ exports.error = function (logText) {
exports.dir = function (logText) {
return beautylog_log_helpers_1.log(logText, 'dir');
};
/**
* creates a new empty line
* @param linesArg
* @returns void
*/
exports.newLine = function (linesArg) {
if (linesArg === void 0) { linesArg = 1; }
for (var i = 0; i < linesArg; i++) {
console.log("\n");
}
};
/**
* 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 sameMessageCounter = 0;
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImJlYXV0eWxvZy5sb2cudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLFFBQU8sZ0JBQWdCLENBQUMsQ0FBQTtBQUV4QixzQ0FBa0IseUJBQXlCLENBQUMsQ0FBQTtBQUM1QyxzQ0FBa0IseUJBQXlCLENBQUM7QUFBcEMsMENBQW9DO0FBRTVDOzs7O0dBSUc7QUFDUSxZQUFJLEdBQUcsVUFBQyxPQUFPO0lBQ3RCLE1BQU0sQ0FBQywyQkFBRyxDQUFDLE9BQU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tYmVyID0gMSkgPT4ge1xuICAgIGZvcihsZXQgaSA9IDA7IGkgPCBsaW5lc0FyZztpKyspe1xuICAgICAgICBjb25zb2xlLmxvZyhcIlxcblwiKTtcbiAgICB9XG59XG5cbi8qKlxuICogbG9ncyBhIHJlZHVjZWQgbG9nIHRoYXQgb25seSBsb2dzIGNoYW5nZXMgb2YgY29uc2VxdWVudGlhbCBsb2cgbWVzc2FnZXNcbiAqL1xuZXhwb3J0IGxldCBsb2dSZWR1Y2VkID0gKGxvZ1RleHRBcmc6c3RyaW5nLHJlcGVhdEV2ZXJ5VGltZXNBcmc6bnVtYmVyID0gMCkgPT4ge1xuICAgIGlmKGxvZ1RleHRBcmcgPT0gcHJldmlvdXNNZXNzYWdlICYmIChyZXBlYXRFdmVyeVRpbWVzQXJnID09IDAgfHwgc2FtZU1lc3NhZ2VDb3VudGVyICE9IHJlcGVhdEV2ZXJ5VGltZXNBcmcpKXtcbiAgICAgICAgc2FtZU1lc3NhZ2VDb3VudGVyKys7XG4gICAgfSBlbHNlIHtcbiAgICAgICAgc2FtZU1lc3NhZ2VDb3VudGVyID0gMDtcbiAgICAgICAgcHJldmlvdXNNZXNzYWdlID0gbG9nVGV4dEFyZztcbiAgICAgICAgbG9nKGxvZ1RleHRBcmcpO1xuICAgIH1cbn07XG5sZXQgcHJldmlvdXNNZXNzYWdlOnN0cmluZyA9IFwiXCI7XG5sZXQgc2FtZU1lc3NhZ2VDb3VudGVyOm51bWJlciA9IDA7Il19

2
dist/index.d.ts vendored
View File

@ -1,5 +1,5 @@
import "typings-global";
export { Table } from "./beautylog.classes.table";
export { Ora } from "./beautylog.classes.ora";
export { dir, error, info, log, ok, success, warn, newLine } from "./beautylog.log";
export { dir, error, info, log, logReduced, ok, success, warn, newLine } from "./beautylog.log";
export { figlet, figletSync } from "./beautylog.figlet";

3
dist/index.js vendored
View File

@ -11,6 +11,7 @@ exports.dir = beautylog_log_1.dir;
exports.error = beautylog_log_1.error;
exports.info = beautylog_log_1.info;
exports.log = beautylog_log_1.log;
exports.logReduced = beautylog_log_1.logReduced;
exports.ok = beautylog_log_1.ok;
exports.success = beautylog_log_1.success;
exports.warn = beautylog_log_1.warn;
@ -19,4 +20,4 @@ var beautylog_figlet_1 = require("./beautylog.figlet");
exports.figlet = beautylog_figlet_1.figlet;
exports.figletSync = beautylog_figlet_1.figletSync;
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImluZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSxRQUFPLGdCQUFnQixDQUFDLENBQUE7QUFLeEIsaUJBQWlCO0FBQ2pCLHdDQUFvQiwyQkFBMkIsQ0FBQztBQUF4QyxnREFBd0M7QUFDaEQsc0NBQWtCLHlCQUF5QixDQUFDO0FBQXBDLDBDQUFvQztBQUU1QyxpQkFBaUI7QUFDakIsOEJBQXlELGlCQUFpQixDQUFDO0FBQW5FLGtDQUFHO0FBQUMsc0NBQUs7QUFBQyxvQ0FBSTtBQUFDLGtDQUFHO0FBQUMsZ0NBQUU7QUFBQywwQ0FBTztBQUFDLG9DQUFJO0FBQUMsMENBQWdDO0FBQzNFLGlDQUFnQyxvQkFBb0IsQ0FBQztBQUE3QywyQ0FBTTtBQUFDLG1EQUFxQyIsImZpbGUiOiJpbmRleC5qcyIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCBcInR5cGluZ3MtZ2xvYmFsXCI7XG5cbmltcG9ydCAqIGFzIHBsdWdpbnMgZnJvbSBcIi4vYmVhdXR5bG9nLnBsdWdpbnNcIjtcbmltcG9ydCAqIGFzIEJlYXV0eWxvZ0NvbnNvbGUgZnJvbSBcIi4vYmVhdXR5bG9nLmNvbnNvbGVcIjtcblxuLy8gZXhwb3J0IGNsYXNzZXNcbmV4cG9ydCB7VGFibGV9IGZyb20gXCIuL2JlYXV0eWxvZy5jbGFzc2VzLnRhYmxlXCI7XG5leHBvcnQge09yYX0gZnJvbSBcIi4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cIi4vYmVhdXR5bG9nLmNsYXNzZXMudGFibGVcIjtcbmV4cG9ydCB7T3JhfSBmcm9tIFwiLi9iZWF1dHlsb2cuY2xhc3Nlcy5vcmFcIjtcblxuLy8gZXhwb3J0IG1ldGhvZHNcbmV4cG9ydCB7ZGlyLGVycm9yLGluZm8sbG9nLGxvZ1JlZHVjZWQsb2ssc3VjY2Vzcyx3YXJuLG5ld0xpbmV9IGZyb20gXCIuL2JlYXV0eWxvZy5sb2dcIjtcbmV4cG9ydCB7ZmlnbGV0LGZpZ2xldFN5bmN9IGZyb20gXCIuL2JlYXV0eWxvZy5maWdsZXRcIiJdfQ==

File diff suppressed because one or more lines are too long

View File

@ -41,6 +41,16 @@ describe("beautylog",function(){
beautylog.info('beautylog.dir(), with normal logText, without logType');
});
});
describe(".logReduced(message)",function(){
it("should only log two messages",function(){
beautylog.logReduced("Message 1");
beautylog.logReduced("Message 1");
beautylog.logReduced("Message 1");
beautylog.logReduced("Message 1");
beautylog.logReduced("Message 2");
beautylog.logReduced("Message 2");
})
})
describe(".ok(message)",function(){
it("should display a green ok message",function(){
beautylog.ok('beautylog.ok(), with normal logText, without logType');

View File

@ -57,8 +57,28 @@ export let dir = (logText) => {
return log(logText, 'dir');
};
/**
* creates a new empty line
* @param linesArg
* @returns void
*/
export let newLine = (linesArg:number = 1) => {
for(let i = 0; i < linesArg;i++){
console.log("\n");
}
}
}
/**
* logs a reduced log that only logs changes of consequential log messages
*/
export let logReduced = (logTextArg:string,repeatEveryTimesArg:number = 0) => {
if(logTextArg == previousMessage && (repeatEveryTimesArg == 0 || sameMessageCounter != repeatEveryTimesArg)){
sameMessageCounter++;
} else {
sameMessageCounter = 0;
previousMessage = logTextArg;
log(logTextArg);
}
};
let previousMessage:string = "";
let sameMessageCounter:number = 0;

View File

@ -8,5 +8,5 @@ export {Table} from "./beautylog.classes.table";
export {Ora} from "./beautylog.classes.ora";
// export methods
export {dir,error,info,log,ok,success,warn,newLine} from "./beautylog.log";
export {dir,error,info,log,logReduced,ok,success,warn,newLine} from "./beautylog.log";
export {figlet,figletSync} from "./beautylog.figlet"