Comparing version 1.0.2 to 1.0.3
64
index.js
/// <reference path="./index.ts" /> | ||
var ConsoleTable = (function () { | ||
function ConsoleTable(tableType) { | ||
switch (tableType) { | ||
case "checks": | ||
this.tableHead = ['Check Item:'.cyan, 'Status:'.cyan]; | ||
break; | ||
default: | ||
break; | ||
} | ||
this.rows = []; | ||
this.type = tableType; | ||
} | ||
ConsoleTable.prototype.push = function (row) { | ||
this.rows.push(row); | ||
}; | ||
ConsoleTable.prototype.print = function () { | ||
var table = new BeautylogOsTable.cliTable({ | ||
head: this.tableHead, | ||
colWidths: [20, 20] | ||
}); | ||
for (var row in this.rows) { | ||
if (this.rows[row][1] == "success") { | ||
this.rows[row][1] = ' '.bgGreen + ' ' + this.rows[row][1]; | ||
} | ||
else if (this.rows[row][1] == "error") { | ||
this.rows[row][1] = ' '.bgRed + ' ' + this.rows[row][1]; | ||
} | ||
table.push(this.rows[row]); | ||
} | ||
; | ||
console.log(table.toString()); | ||
}; | ||
return ConsoleTable; | ||
})(); | ||
/// <reference path="./index.ts" /> | ||
var BeautylogOS; | ||
@@ -7,8 +42,4 @@ (function (BeautylogOS) { | ||
var clc = require("cli-color"); | ||
var beautylogOS = {}; | ||
/** | ||
* object to append to all locally used params | ||
* @type {{}} | ||
*/ | ||
var localBl; | ||
var beautylogOS = {}; //object to append to all public facing functions | ||
var localBl; // object to append to all private params and functions | ||
localBl = {}; | ||
@@ -114,2 +145,3 @@ localBl.dirPrefix = clc.bgXterm(39).xterm(231).bold(' DIR ') + ' '; | ||
}; | ||
beautylogOS.table = BeautylogOsTable.init(); | ||
return beautylogOS; | ||
@@ -120,2 +152,16 @@ } | ||
/// <reference path="./index.ts" /> | ||
var BeautylogOsTable; | ||
(function (BeautylogOsTable) { | ||
function init() { | ||
BeautylogOsTable.cliTable = require("cli-table2"); | ||
var beautylogOsTable = {}; | ||
beautylogOsTable.new = function (type) { | ||
var newConsoleTable = new ConsoleTable(type); | ||
return newConsoleTable; | ||
}; | ||
return beautylogOsTable; | ||
} | ||
BeautylogOsTable.init = init; | ||
})(BeautylogOsTable || (BeautylogOsTable = {})); | ||
/// <reference path="./index.ts" /> | ||
var BeautylogBrowser; | ||
@@ -145,4 +191,6 @@ (function (BeautylogBrowser) { | ||
/// <reference path="./typings/tsd.d.ts" /> | ||
/// <reference path="./console.os.ts" /> | ||
/// <reference path="./console.browser.ts" /> | ||
/// <reference path="./beautylog.classes.ts" /> | ||
/// <reference path="./beautylog.os.ts" /> | ||
/// <reference path="./beautylog.os.table.ts" /> | ||
/// <reference path="./beautylog.browser.ts" /> | ||
var beautylog = function (logPlatform) { | ||
@@ -149,0 +197,0 @@ if (logPlatform === void 0) { logPlatform = "os"; } |
{ | ||
"name": "beautylog", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "beautiful logging", | ||
@@ -27,5 +27,6 @@ "main": "index.js", | ||
"dependencies": { | ||
"cli-color": "^1.0.0", | ||
"cli-color": "^1.1.0", | ||
"cli-table2": "^0.1.9", | ||
"colors": "1.1.2" | ||
} | ||
} |
14
test.js
/// <reference path="./typings/tsd.d.ts" /> | ||
var beautyLogOs = require('./index.js')("os"); | ||
var beautyLogBrowser = require("./index.js")("browser"); | ||
console.log('*** start test ***'); | ||
console.log('*** start OS console test ***'); | ||
console.log(''); | ||
@@ -24,4 +24,12 @@ console.log('declarative function calls:'); | ||
console.log(''); | ||
console.log('*** end test ***'); | ||
console.log("start test of beautylog browser module (Might look weird in is console...)"); | ||
console.log('*** end OS console test ***'); | ||
console.log("*** start browser console test (Might look weird in OS console and travis log...) ***"); | ||
beautyLogBrowser.log("hello"); | ||
console.log("*** end browser console test ***"); | ||
console.log("*** start table test ***"); | ||
var testTable = beautyLogOs.table.new("checks"); | ||
testTable.push(['check1', 'success']); | ||
testTable.push(['check2', 'error']); | ||
testTable.push(['check3', 'error']); | ||
testTable.print(); | ||
console.log("*** end table test ***"); |
/// <reference path="./typings/tsd.d.ts" /> | ||
/// <reference path="./console.os.ts" /> | ||
/// <reference path="./console.browser.ts" /> | ||
/// <reference path="./beautylog.classes.ts" /> | ||
/// <reference path="./beautylog.os.ts" /> | ||
/// <reference path="./beautylog.os.table.ts" /> | ||
/// <reference path="./beautylog.browser.ts" /> | ||
var beautylog = function (logPlatform) { | ||
@@ -5,0 +7,0 @@ if (logPlatform === void 0) { logPlatform = "os"; } |
/// <reference path="./typings/tsd.d.ts" /> | ||
/// <reference path="./console.os.ts" /> | ||
/// <reference path="./console.browser.ts" /> | ||
/// <reference path="./beautylog.classes.ts" /> | ||
/// <reference path="./beautylog.os.ts" /> | ||
/// <reference path="./beautylog.os.table.ts" /> | ||
/// <reference path="./beautylog.browser.ts" /> | ||
@@ -5,0 +7,0 @@ var beautylog = function(logPlatform:string = "os") { |
/// <reference path="./typings/tsd.d.ts" /> | ||
var beautyLogOs = require('./index.js')("os"); | ||
var beautyLogBrowser = require("./index.js")("browser"); | ||
console.log('*** start test ***'); | ||
console.log('*** start OS console test ***'); | ||
console.log(''); | ||
@@ -24,5 +24,13 @@ console.log('declarative function calls:'); | ||
console.log(''); | ||
console.log('*** end test ***'); | ||
console.log("start test of beautylog browser module (Might look weird in is console...)"); | ||
console.log('*** end OS console test ***'); | ||
console.log("*** start browser console test (Might look weird in OS console and travis log...) ***"); | ||
beautyLogBrowser.log("hello"); | ||
console.log("*** end browser console test ***"); | ||
console.log("*** start table test ***"); | ||
var testTable = beautyLogOs.table.new("checks"); | ||
testTable.push(['check1', 'success']); | ||
testTable.push(['check2', 'error']); | ||
testTable.push(['check3', 'error']); | ||
testTable.print(); | ||
console.log("*** end table test ***"); | ||
//# sourceMappingURL=test.js.map |
@@ -5,3 +5,3 @@ /// <reference path="./typings/tsd.d.ts" /> | ||
console.log('*** start test ***'); | ||
console.log('*** start OS console test ***'); | ||
console.log (''); | ||
@@ -30,5 +30,14 @@ | ||
console.log (''); | ||
console.log('*** end test ***'); | ||
console.log('*** end OS console test ***'); | ||
console.log("start test of beautylog browser module (Might look weird in is console...)"); | ||
beautyLogBrowser.log("hello"); | ||
console.log("*** start browser console test (Might look weird in OS console and travis log...) ***"); | ||
beautyLogBrowser.log("hello"); | ||
console.log("*** end browser console test ***"); | ||
console.log("*** start table test ***"); | ||
var testTable = beautyLogOs.table.new("checks"); | ||
testTable.push(['check1','success']); | ||
testTable.push(['check2','error']); | ||
testTable.push(['check3','error']); | ||
testTable.print(); | ||
console.log("*** end table test ***"); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
133819
32
2811
3
+ Addedcli-table2@^0.1.9
+ Addedcli-table2@0.1.9(transitive)
+ Addedcolors@1.0.3(transitive)
+ Addedlodash@2.4.1(transitive)
Updatedcli-color@^1.1.0