add code function
This commit is contained in:
parent
1f9a2257fc
commit
ea06f32ce0
@ -26,6 +26,10 @@ bl.log('some error message','error');
|
||||
The plugin produces beautiful output like this:
|
||||
![console.png](https://mediaserve.lossless.digital/github.com/pushrocks/beautylog/console.png)
|
||||
|
||||
### Code Highlighting
|
||||
|
||||
|
||||
|
||||
### Console Tables
|
||||
beautylog allows displaying data in nice tables for better overview.
|
||||
|
||||
@ -55,3 +59,4 @@ myTable.print(); //prints myTable to the console
|
||||
|
||||
The table from the code with type "checks" above looks like this:
|
||||
![table.png](https://mediaserve.lossless.digital/github.com/pushrocks/beautylog/table.png)
|
||||
|
||||
|
120
code.css
Normal file
120
code.css
Normal file
@ -0,0 +1,120 @@
|
||||
.hljs {
|
||||
display: block;
|
||||
padding: 0.5em;
|
||||
color: #333;
|
||||
background: #f8f8f8;
|
||||
}
|
||||
|
||||
.hljs-comment,
|
||||
.hljs-template_comment,
|
||||
.diff .hljs-header,
|
||||
.hljs-javadoc {
|
||||
color: #998;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
.hljs-keyword,
|
||||
.css .rule .hljs-keyword,
|
||||
.hljs-winutils,
|
||||
.javascript .hljs-title,
|
||||
.nginx .hljs-title,
|
||||
.hljs-subst,
|
||||
.hljs-request,
|
||||
.hljs-status {
|
||||
color: #333;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.hljs-number,
|
||||
.hljs-hexcolor,
|
||||
.ruby .hljs-constant {
|
||||
color: #099;
|
||||
}
|
||||
|
||||
.hljs-string,
|
||||
.hljs-tag .hljs-value,
|
||||
.hljs-phpdoc,
|
||||
.tex .hljs-formula {
|
||||
color: #d14;
|
||||
}
|
||||
|
||||
.hljs-title,
|
||||
.hljs-id,
|
||||
.coffeescript .hljs-params,
|
||||
.scss .hljs-preprocessor {
|
||||
color: #900;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.javascript .hljs-title,
|
||||
.lisp .hljs-title,
|
||||
.clojure .hljs-title,
|
||||
.hljs-subst {
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
.hljs-class .hljs-title,
|
||||
.haskell .hljs-type,
|
||||
.vhdl .hljs-literal,
|
||||
.tex .hljs-command {
|
||||
color: #458;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.hljs-tag,
|
||||
.hljs-tag .hljs-title,
|
||||
.hljs-rules .hljs-property,
|
||||
.django .hljs-tag .hljs-keyword {
|
||||
color: #000080;
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
.hljs-attribute,
|
||||
.hljs-variable,
|
||||
.lisp .hljs-body {
|
||||
color: #008080;
|
||||
}
|
||||
|
||||
.hljs-regexp {
|
||||
color: #009926;
|
||||
}
|
||||
|
||||
.hljs-symbol,
|
||||
.ruby .hljs-symbol .hljs-string,
|
||||
.lisp .hljs-keyword,
|
||||
.tex .hljs-special,
|
||||
.hljs-prompt {
|
||||
color: #990073;
|
||||
}
|
||||
|
||||
.hljs-built_in,
|
||||
.lisp .hljs-title,
|
||||
.clojure .hljs-built_in {
|
||||
color: #0086b3;
|
||||
}
|
||||
|
||||
.hljs-preprocessor,
|
||||
.hljs-pragma,
|
||||
.hljs-pi,
|
||||
.hljs-doctype,
|
||||
.hljs-shebang,
|
||||
.hljs-cdata {
|
||||
color: #999;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.hljs-deletion {
|
||||
background: #fdd;
|
||||
}
|
||||
|
||||
.hljs-addition {
|
||||
background: #dfd;
|
||||
}
|
||||
|
||||
.diff .hljs-change {
|
||||
background: #0086b3;
|
||||
}
|
||||
|
||||
.hljs-chunk {
|
||||
color: #aaa;
|
||||
}
|
16
index.d.ts
vendored
16
index.d.ts
vendored
@ -1,8 +1,6 @@
|
||||
/// <reference path="ts/typings/tsd.d.ts" />
|
||||
declare module BeautylogPlugins {
|
||||
var init: () => {
|
||||
smartenv: any;
|
||||
};
|
||||
var init: () => any;
|
||||
}
|
||||
declare var tableHelpers: {
|
||||
makeRow: (cellCounterArg?: number, colorArg?: string) => any[];
|
||||
@ -18,14 +16,18 @@ declare class ConsoleTable {
|
||||
declare module BeautylogNode {
|
||||
function init(): any;
|
||||
}
|
||||
declare module BeautylogOsTable {
|
||||
declare module BeautylogNodeLog {
|
||||
var init: () => (logText?: string, logType?: string) => boolean;
|
||||
}
|
||||
declare module BeautylogNodeCode {
|
||||
var init: () => (codeString: any, options?: any) => void;
|
||||
}
|
||||
declare module BeautylogNodeTable {
|
||||
var cliTable: any;
|
||||
function init(): any;
|
||||
}
|
||||
declare module BeautylogBrowser {
|
||||
function init(): any;
|
||||
}
|
||||
declare var plugins: {
|
||||
smartenv: any;
|
||||
};
|
||||
declare var plugins: any;
|
||||
declare var beautylog: any;
|
||||
|
180
index.js
180
index.js
@ -42,7 +42,7 @@ var ConsoleTable = (function () {
|
||||
this.rows.push(row);
|
||||
};
|
||||
ConsoleTable.prototype.print = function () {
|
||||
var table = new BeautylogOsTable.cliTable({
|
||||
var table = new BeautylogNodeTable.cliTable({
|
||||
head: this.tableHead
|
||||
});
|
||||
for (var row in this.rows) {
|
||||
@ -63,64 +63,12 @@ var ConsoleTable = (function () {
|
||||
var BeautylogNode;
|
||||
(function (BeautylogNode) {
|
||||
function init() {
|
||||
var colors = require("colors");
|
||||
var clc = require("cli-color");
|
||||
var beautylogNode = {}; //object to append to all public facing functions
|
||||
var localBl; // object to append to all private params and functions
|
||||
localBl = {};
|
||||
localBl.dirPrefix = clc.bgXterm(39).xterm(231).bold(' DIR ') + ' ';
|
||||
localBl.errorPrefix = ' Error: '.bgRed.white.bold + ' ';
|
||||
localBl.infoPrefix = clc.bgXterm(198).xterm(231).bold(' INFO ') + ' ';
|
||||
localBl.normalPrefix = ' Log: '.bgCyan.white.bold + ' ';
|
||||
localBl.okPrefix = ' '.bgGreen + ' OK! '.bgBlack.green.bold + ' ';
|
||||
localBl.successPrefix = ' Success: '.bgGreen.white.bold + ' ';
|
||||
localBl.warnPrefix = ' '.bgYellow + ' Warn: '.bgBlack.yellow.bold + ' ';
|
||||
/**
|
||||
*
|
||||
* @param logText
|
||||
* @param logType
|
||||
* @returns {boolean}
|
||||
*/
|
||||
beautylogNode.log = function (logText, logType) {
|
||||
if (logText === void 0) { logText = 'empty log'; }
|
||||
if (logType === void 0) { logType = 'normal'; }
|
||||
try {
|
||||
switch (logType) {
|
||||
case 'dir':
|
||||
logText = localBl.dirPrefix + clc.xterm(26)(logText);
|
||||
break;
|
||||
case 'error':
|
||||
logText = localBl.errorPrefix + logText.red.bold;
|
||||
break;
|
||||
case 'info':
|
||||
logText = localBl.infoPrefix + clc.xterm(198)(logText);
|
||||
break;
|
||||
case 'normal':
|
||||
logText = localBl.normalPrefix + logText.cyan.bold;
|
||||
break;
|
||||
case 'ok':
|
||||
logText = localBl.okPrefix + logText.bold;
|
||||
break;
|
||||
case 'success':
|
||||
logText = localBl.successPrefix + logText.green.bold;
|
||||
break;
|
||||
case 'warn':
|
||||
logText = localBl.warnPrefix + logText.bold;
|
||||
break;
|
||||
case 'log':
|
||||
default:
|
||||
logText.blue.bold;
|
||||
console.log(('unknown logType for "' + logText + '"').red.bold);
|
||||
break;
|
||||
}
|
||||
console.log(logText);
|
||||
return true;
|
||||
}
|
||||
catch (error) {
|
||||
console.log(localBl.errorPrefix + 'You seem to have tried logging something strange'.red.bold + error);
|
||||
return false;
|
||||
}
|
||||
};
|
||||
plugins.colors = require("colors");
|
||||
plugins.clc = require("cli-color");
|
||||
var beautylogNode = {
|
||||
log: BeautylogNodeLog.init(),
|
||||
code: BeautylogNodeCode.init()
|
||||
}; //object to append to all public facing functions
|
||||
/**
|
||||
* logs an directory to console
|
||||
* @param logText
|
||||
@ -169,16 +117,116 @@ var BeautylogNode;
|
||||
beautylogNode.warn = function (logText) {
|
||||
return beautylogNode.log(logText, 'warn');
|
||||
};
|
||||
beautylogNode.table = BeautylogOsTable.init();
|
||||
beautylogNode.table = BeautylogNodeTable.init();
|
||||
return beautylogNode;
|
||||
}
|
||||
BeautylogNode.init = init;
|
||||
})(BeautylogNode || (BeautylogNode = {}));
|
||||
/// <reference path="./index.ts" />
|
||||
var BeautylogOsTable;
|
||||
(function (BeautylogOsTable) {
|
||||
var BeautylogNodeLog;
|
||||
(function (BeautylogNodeLog) {
|
||||
BeautylogNodeLog.init = function () {
|
||||
var localBl = {
|
||||
dirPrefix: plugins.clc.bgXterm(39).xterm(231).bold(' DIR ') + ' ',
|
||||
errorPrefix: ' Error: '.bgRed.white.bold + ' ',
|
||||
infoPrefix: plugins.clc.bgXterm(198).xterm(231).bold(' INFO ') + ' ',
|
||||
normalPrefix: ' Log: '.bgCyan.white.bold + ' ',
|
||||
okPrefix: ' '.bgGreen + ' OK! '.bgBlack.green.bold + ' ',
|
||||
successPrefix: ' Success: '.bgGreen.white.bold + ' ',
|
||||
warnPrefix: ' '.bgYellow + ' Warn: '.bgBlack.yellow.bold + ' '
|
||||
};
|
||||
/**
|
||||
*
|
||||
* @param logText
|
||||
* @param logType
|
||||
* @returns {boolean}
|
||||
*/
|
||||
var logFunction = function (logText, logType) {
|
||||
if (logText === void 0) { logText = 'empty log'; }
|
||||
if (logType === void 0) { logType = 'normal'; }
|
||||
try {
|
||||
switch (logType) {
|
||||
case 'dir':
|
||||
logText = localBl.dirPrefix + plugins.clc.xterm(26)(logText);
|
||||
break;
|
||||
case 'error':
|
||||
logText = localBl.errorPrefix + logText.red.bold;
|
||||
break;
|
||||
case 'info':
|
||||
logText = localBl.infoPrefix + plugins.clc.xterm(198)(logText);
|
||||
break;
|
||||
case 'normal':
|
||||
logText = localBl.normalPrefix + logText.cyan.bold;
|
||||
break;
|
||||
case 'ok':
|
||||
logText = localBl.okPrefix + logText.bold;
|
||||
break;
|
||||
case 'success':
|
||||
logText = localBl.successPrefix + logText.green.bold;
|
||||
break;
|
||||
case 'warn':
|
||||
logText = localBl.warnPrefix + logText.bold;
|
||||
break;
|
||||
case 'log':
|
||||
default:
|
||||
logText.blue.bold;
|
||||
console.log(('unknown logType for "' + logText + '"').red.bold);
|
||||
break;
|
||||
}
|
||||
console.log(logText);
|
||||
return true;
|
||||
}
|
||||
catch (error) {
|
||||
console.log(localBl.errorPrefix + 'You seem to have tried logging something strange'.red.bold + error);
|
||||
return false;
|
||||
}
|
||||
};
|
||||
return logFunction;
|
||||
};
|
||||
})(BeautylogNodeLog || (BeautylogNodeLog = {}));
|
||||
/// <reference path="./index.ts" />
|
||||
var BeautylogNodeCode;
|
||||
(function (BeautylogNodeCode) {
|
||||
BeautylogNodeCode.init = function () {
|
||||
var consoleHighlight = function (code, language) {
|
||||
var fs = require('fs'), path = require('path'), htmlout = require('html2console'), hljs = require('highlight.js');
|
||||
var css = fs.readFileSync(path.join(__dirname, 'code.css'), 'utf8');
|
||||
var result;
|
||||
if (typeof language === "undefined") {
|
||||
result = hljs.highlight(language, code);
|
||||
}
|
||||
else {
|
||||
result = hljs.highlightAuto(code);
|
||||
}
|
||||
;
|
||||
var html = result.value;
|
||||
var output = htmlout.withCSS(css);
|
||||
//console.log(html);
|
||||
return output('<pre class="hljs">' + html + '</pre>');
|
||||
};
|
||||
var codeFunction = function (codeString, options) {
|
||||
var codeSnippet = {
|
||||
source: codeString,
|
||||
highlighted: "default"
|
||||
};
|
||||
if (typeof codeString != "string") {
|
||||
console.log("beautylog.code() expects a string as first argument!");
|
||||
return;
|
||||
}
|
||||
;
|
||||
if (typeof options != "undefined") {
|
||||
codeSnippet.highlighted = consoleHighlight(codeSnippet.source, options.language);
|
||||
console.log(codeSnippet.highlighted);
|
||||
}
|
||||
};
|
||||
return codeFunction;
|
||||
};
|
||||
})(BeautylogNodeCode || (BeautylogNodeCode = {}));
|
||||
/// <reference path="./index.ts" />
|
||||
var BeautylogNodeTable;
|
||||
(function (BeautylogNodeTable) {
|
||||
function init() {
|
||||
BeautylogOsTable.cliTable = require("cli-table2");
|
||||
BeautylogNodeTable.cliTable = require("cli-table2");
|
||||
var beautylogOsTable = {};
|
||||
beautylogOsTable.new = function (typeArg, tableHeadArrayArg) {
|
||||
var newConsoleTable = new ConsoleTable(typeArg, tableHeadArrayArg);
|
||||
@ -186,8 +234,8 @@ var BeautylogOsTable;
|
||||
};
|
||||
return beautylogOsTable;
|
||||
}
|
||||
BeautylogOsTable.init = init;
|
||||
})(BeautylogOsTable || (BeautylogOsTable = {}));
|
||||
BeautylogNodeTable.init = init;
|
||||
})(BeautylogNodeTable || (BeautylogNodeTable = {}));
|
||||
/// <reference path="./index.ts" />
|
||||
var BeautylogBrowser;
|
||||
(function (BeautylogBrowser) {
|
||||
@ -216,6 +264,8 @@ var BeautylogBrowser;
|
||||
/// <reference path="./beautylog.plugins.ts" />
|
||||
/// <reference path="./beautylog.classes.ts" />
|
||||
/// <reference path="./beautylog.node.ts" />
|
||||
/// <reference path="./beautylog.node.log.ts" />
|
||||
/// <reference path="./beautylog.node.code.ts" />
|
||||
/// <reference path="./beautylog.node.table.ts" />
|
||||
/// <reference path="./beautylog.browser.ts" />
|
||||
var plugins = BeautylogPlugins.init();
|
||||
|
@ -33,12 +33,14 @@
|
||||
"cli-color": "^1.1.0",
|
||||
"cli-table2": "^0.1.9",
|
||||
"colors": "1.1.2",
|
||||
"highlight.js": "^9.1.0",
|
||||
"html2console": "0.0.4",
|
||||
"smartenv": "0.0.15"
|
||||
},
|
||||
"devDependencies": {
|
||||
"easyserve": "0.0.4",
|
||||
"easyserve": "0.0.5",
|
||||
"gulp": "^3.9.0",
|
||||
"gulp-browser": "0.0.18",
|
||||
"npmts": "^1.0.9"
|
||||
"gulp-browser": "1.0.3",
|
||||
"npmts": "^1.0.12"
|
||||
}
|
||||
}
|
||||
|
4
test.js
4
test.js
@ -34,3 +34,7 @@ console.log("*** start table test ***");
|
||||
testTable2.print();
|
||||
})();
|
||||
console.log("*** end table test ***");
|
||||
console.log("*** start code test ***");
|
||||
beautyLog.code("var test = 3; function(){}\n", {
|
||||
language: "javascript"
|
||||
});
|
||||
|
@ -31,7 +31,7 @@ class ConsoleTable {
|
||||
this.rows.push(row);
|
||||
}
|
||||
print() {
|
||||
var table = new BeautylogOsTable.cliTable({
|
||||
var table = new BeautylogNodeTable.cliTable({
|
||||
head: this.tableHead
|
||||
});
|
||||
for (var row in this.rows){
|
||||
|
43
ts/beautylog.node.code.ts
Normal file
43
ts/beautylog.node.code.ts
Normal file
@ -0,0 +1,43 @@
|
||||
/// <reference path="./index.ts" />
|
||||
module BeautylogNodeCode {
|
||||
export var init = function() {
|
||||
|
||||
var consoleHighlight = function(code:string,language:string) {
|
||||
var fs = require('fs'),
|
||||
path = require('path'),
|
||||
htmlout = require('html2console'),
|
||||
hljs = require('highlight.js');
|
||||
|
||||
var css = fs.readFileSync(path.join(__dirname, 'code.css'), 'utf8');
|
||||
|
||||
var result;
|
||||
if (typeof language === "undefined"){
|
||||
result = hljs.highlight(language, code)
|
||||
} else {
|
||||
result = hljs.highlightAuto(code);
|
||||
};
|
||||
|
||||
var html = result.value;
|
||||
var output = htmlout.withCSS(css);
|
||||
//console.log(html);
|
||||
return output('<pre class="hljs">' + html + '</pre>');
|
||||
};
|
||||
|
||||
|
||||
var codeFunction = function(codeString,options?){
|
||||
var codeSnippet = {
|
||||
source:codeString,
|
||||
highlighted:"default"
|
||||
};
|
||||
if (typeof codeString != "string"){
|
||||
console.log("beautylog.code() expects a string as first argument!");
|
||||
return;
|
||||
};
|
||||
if (typeof options != "undefined"){
|
||||
codeSnippet.highlighted = consoleHighlight(codeSnippet.source,options.language);
|
||||
console.log(codeSnippet.highlighted)
|
||||
}
|
||||
};
|
||||
return codeFunction;
|
||||
}
|
||||
}
|
61
ts/beautylog.node.log.ts
Normal file
61
ts/beautylog.node.log.ts
Normal file
@ -0,0 +1,61 @@
|
||||
/// <reference path="./index.ts" />
|
||||
module BeautylogNodeLog {
|
||||
export var init = function(){
|
||||
|
||||
var localBl = {
|
||||
dirPrefix: plugins.clc.bgXterm(39).xterm(231).bold(' DIR ') + ' ',
|
||||
errorPrefix: ' Error: '.bgRed.white.bold + ' ',
|
||||
infoPrefix: plugins.clc.bgXterm(198).xterm(231).bold(' INFO ') + ' ',
|
||||
normalPrefix: ' Log: '.bgCyan.white.bold + ' ',
|
||||
okPrefix: ' '.bgGreen + ' OK! '.bgBlack.green.bold + ' ',
|
||||
successPrefix: ' Success: '.bgGreen.white.bold + ' ',
|
||||
warnPrefix: ' '.bgYellow + ' Warn: '.bgBlack.yellow.bold + ' '
|
||||
};
|
||||
|
||||
/**
|
||||
*
|
||||
* @param logText
|
||||
* @param logType
|
||||
* @returns {boolean}
|
||||
*/
|
||||
var logFunction = function(logText:string = 'empty log', logType:string = 'normal') {
|
||||
try {
|
||||
switch (logType) {
|
||||
case 'dir':
|
||||
logText = localBl.dirPrefix + plugins.clc.xterm(26)(logText);
|
||||
break;
|
||||
case 'error':
|
||||
logText = localBl.errorPrefix + logText.red.bold;
|
||||
break;
|
||||
case 'info':
|
||||
logText = localBl.infoPrefix + plugins.clc.xterm(198)(logText);
|
||||
break;
|
||||
case 'normal':
|
||||
logText = localBl.normalPrefix + logText.cyan.bold;
|
||||
break;
|
||||
case 'ok':
|
||||
logText = localBl.okPrefix + logText.bold;
|
||||
break;
|
||||
case 'success':
|
||||
logText = localBl.successPrefix + logText.green.bold;
|
||||
break;
|
||||
case 'warn':
|
||||
logText = localBl.warnPrefix + logText.bold;
|
||||
break;
|
||||
case 'log':
|
||||
default:
|
||||
logText.blue.bold;
|
||||
console.log(('unknown logType for "' + logText + '"').red.bold);
|
||||
break;
|
||||
}
|
||||
console.log(logText);
|
||||
return true;
|
||||
}
|
||||
catch (error) {
|
||||
console.log(localBl.errorPrefix + 'You seem to have tried logging something strange'.red.bold + error);
|
||||
return false;
|
||||
}
|
||||
};
|
||||
return logFunction;
|
||||
}
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
/// <reference path="./index.ts" />
|
||||
module BeautylogOsTable {
|
||||
module BeautylogNodeTable {
|
||||
export var cliTable;
|
||||
export function init() {
|
||||
cliTable = require("cli-table2");
|
||||
|
@ -1,67 +1,13 @@
|
||||
/// <reference path="./index.ts" />
|
||||
module BeautylogNode {
|
||||
export function init() {
|
||||
var colors = require("colors");
|
||||
var clc = require("cli-color");
|
||||
|
||||
var beautylogNode:any = {}; //object to append to all public facing functions
|
||||
var localBl:any; // object to append to all private params and functions
|
||||
|
||||
localBl = {};
|
||||
localBl.dirPrefix = clc.bgXterm(39).xterm(231).bold(' DIR ') + ' ';
|
||||
localBl.errorPrefix = ' Error: '.bgRed.white.bold + ' ';
|
||||
localBl.infoPrefix = clc.bgXterm(198).xterm(231).bold(' INFO ') + ' ';
|
||||
localBl.normalPrefix = ' Log: '.bgCyan.white.bold + ' ';
|
||||
localBl.okPrefix = ' '.bgGreen + ' OK! '.bgBlack.green.bold + ' ';
|
||||
localBl.successPrefix = ' Success: '.bgGreen.white.bold + ' ';
|
||||
localBl.warnPrefix = ' '.bgYellow + ' Warn: '.bgBlack.yellow.bold + ' ';
|
||||
|
||||
/**
|
||||
*
|
||||
* @param logText
|
||||
* @param logType
|
||||
* @returns {boolean}
|
||||
*/
|
||||
beautylogNode.log = (logText:string = 'empty log', logType:string = 'normal') => {
|
||||
try {
|
||||
switch (logType) {
|
||||
case 'dir':
|
||||
logText = localBl.dirPrefix + clc.xterm(26)(logText);
|
||||
break;
|
||||
case 'error':
|
||||
logText = localBl.errorPrefix + logText.red.bold;
|
||||
break;
|
||||
case 'info':
|
||||
logText = localBl.infoPrefix + clc.xterm(198)(logText);
|
||||
break;
|
||||
case 'normal':
|
||||
logText = localBl.normalPrefix + logText.cyan.bold;
|
||||
break;
|
||||
case 'ok':
|
||||
logText = localBl.okPrefix + logText.bold;
|
||||
break;
|
||||
case 'success':
|
||||
logText = localBl.successPrefix + logText.green.bold;
|
||||
break;
|
||||
case 'warn':
|
||||
logText = localBl.warnPrefix + logText.bold;
|
||||
break;
|
||||
case 'log':
|
||||
default:
|
||||
logText.blue.bold;
|
||||
console.log(('unknown logType for "' + logText + '"').red.bold);
|
||||
break;
|
||||
}
|
||||
console.log(logText);
|
||||
return true;
|
||||
}
|
||||
catch (error) {
|
||||
console.log(localBl.errorPrefix + 'You seem to have tried logging something strange'.red.bold + error);
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
plugins.colors = require("colors");
|
||||
plugins.clc = require("cli-color");
|
||||
|
||||
var beautylogNode:any = {
|
||||
log:BeautylogNodeLog.init(),
|
||||
code:BeautylogNodeCode.init()
|
||||
}; //object to append to all public facing functions
|
||||
|
||||
/**
|
||||
* logs an directory to console
|
||||
@ -118,7 +64,7 @@ module BeautylogNode {
|
||||
return beautylogNode.log(logText, 'warn');
|
||||
};
|
||||
|
||||
beautylogNode.table = BeautylogOsTable.init();
|
||||
beautylogNode.table = BeautylogNodeTable.init();
|
||||
|
||||
return beautylogNode;
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
/// <reference path="./index.ts" />
|
||||
module BeautylogPlugins {
|
||||
export var init = function(){
|
||||
var plugins = {
|
||||
var plugins:any = {
|
||||
smartenv: require("smartenv")
|
||||
};
|
||||
return plugins;
|
||||
|
@ -2,6 +2,8 @@
|
||||
/// <reference path="./beautylog.plugins.ts" />
|
||||
/// <reference path="./beautylog.classes.ts" />
|
||||
/// <reference path="./beautylog.node.ts" />
|
||||
/// <reference path="./beautylog.node.log.ts" />
|
||||
/// <reference path="./beautylog.node.code.ts" />
|
||||
/// <reference path="./beautylog.node.table.ts" />
|
||||
/// <reference path="./beautylog.browser.ts" />
|
||||
|
||||
|
@ -44,3 +44,11 @@ console.log("*** start table test ***");
|
||||
|
||||
|
||||
console.log("*** end table test ***");
|
||||
|
||||
console.log("*** start code test ***");
|
||||
beautyLog.code(
|
||||
"var test = 3; function(){}\n",
|
||||
{
|
||||
language:"javascript"
|
||||
}
|
||||
);
|
Loading…
Reference in New Issue
Block a user