diff --git a/index.js b/index.js index dae93e3..f01ad03 100644 --- a/index.js +++ b/index.js @@ -1,6 +1,5 @@ /// var colors = require("colors"); -var through = require("through2"); var bl; bl = {}; /** @@ -9,8 +8,9 @@ bl = {}; */ var localBl; localBl = {}; -localBl.errorPrefix = ' Error: '.bgRed.white.bold; -localBl.successPrefix = ' Success: '.bgGreen.white.bold; +localBl.normalPrefix = ' Log: '.bgCyan.white.bold + ' '; +localBl.errorPrefix = ' Error: '.bgRed.white.bold + ' '; +localBl.successPrefix = ' Success: '.bgGreen.white.bold + ' '; /** * * @param logText @@ -23,13 +23,13 @@ bl.log = function (logText, logType) { try { switch (logType) { case 'normal': - logText.cyan.bold; + logText = localBl.normalPrefix + logText.cyan.bold; break; case 'error': logText = localBl.errorPrefix + logText.red.bold; break; case 'success': - logText = localBl.successPrefix + logText.cyan.bold; + logText = localBl.successPrefix + logText.green.bold; break; default: logText.blue.bold; diff --git a/package.json b/package.json index 3cf8831..1595939 100644 --- a/package.json +++ b/package.json @@ -23,6 +23,6 @@ }, "homepage": "https://github.com/pushrocks/beautylog", "dependencies": { - "beautylog": "latest" + "colors": "latest" } } diff --git a/test.js b/test.js new file mode 100644 index 0000000..9cb12ff --- /dev/null +++ b/test.js @@ -0,0 +1,15 @@ +/// +var beautyLog = require('./index.js'); +console.log('*** start test ***'); +console.log(''); +console.log('declarative function calls:'); +beautyLog.log('beautylog.log(), with normal logText, without logType'); +beautyLog.error('beautylog.error(), with normal logText, without logType'); +beautyLog.success('beautylog.success(), with normal logText, without logType'); +console.log(''); +console.log('logType String:'); +beautyLog.log('beautylog.log(), with normal logText, without logType'); +beautyLog.log('beautylog.log(), with normal logText, with logType "error"', 'error'); +beautyLog.log('beautylog.log(), with normal logText, with logType "success"', 'success'); +console.log(''); +console.log('*** end test ***'); diff --git a/ts/compile/gulpfile.js b/ts/compile/gulpfile.js index ab173d0..9e74c65 100644 --- a/ts/compile/gulpfile.js +++ b/ts/compile/gulpfile.js @@ -11,6 +11,15 @@ gulp.task('compileTS', function() { return stream; }); -gulp.task('default',['compileTS'], function() { +gulp.task('compileTSTest', function() { + var stream = gulp.src('../test.ts') + .pipe(gulpTypescript({ + out: "test.js" + })) + .pipe(gulp.dest("../../")); + return stream; +}); + +gulp.task('default',['compileTS','compileTSTest'], function() { console.log('Typescript compiled'); }); \ No newline at end of file diff --git a/ts/index.ts b/ts/index.ts index 6da0a00..a3b3ea6 100644 --- a/ts/index.ts +++ b/ts/index.ts @@ -1,6 +1,5 @@ /// var colors = require("colors"); -var through = require("through2"); var bl:any; @@ -12,8 +11,9 @@ bl = {} */ var localBl:any; localBl = {}; -localBl.errorPrefix = ' Error: '.bgRed.white.bold; -localBl.successPrefix = ' Success: '.bgGreen.white.bold; +localBl.normalPrefix = ' Log: '.bgCyan.white.bold + ' '; +localBl.errorPrefix = ' Error: '.bgRed.white.bold + ' '; +localBl.successPrefix = ' Success: '.bgGreen.white.bold + ' '; /** * @@ -25,13 +25,13 @@ bl.log = (logText:string = 'empty log',logType:string = 'normal') => { try { switch (logType) { case 'normal': - logText.cyan.bold; + logText = localBl.normalPrefix + logText.cyan.bold; break; case 'error': logText = localBl.errorPrefix + logText.red.bold; break; case 'success': - logText = localBl.successPrefix + logText.cyan.bold; + logText = localBl.successPrefix + logText.green.bold; break; default: logText.blue.bold; diff --git a/ts/test.ts b/ts/test.ts new file mode 100644 index 0000000..b49197a --- /dev/null +++ b/ts/test.ts @@ -0,0 +1,20 @@ +/// +var beautyLog = require('./index.js'); + +console.log('*** start test ***'); +console.log (''); + +console.log('declarative function calls:'); +beautyLog.log('beautylog.log(), with normal logText, without logType'); +beautyLog.error('beautylog.error(), with normal logText, without logType'); +beautyLog.success('beautylog.success(), with normal logText, without logType'); + +console.log(''); + +console.log('logType String:'); +beautyLog.log('beautylog.log(), with normal logText, without logType'); +beautyLog.log('beautylog.log(), with normal logText, with logType "error"','error'); +beautyLog.log('beautylog.log(), with normal logText, with logType "success"','success'); + +console.log (''); +console.log('*** end test ***'); \ No newline at end of file