add beautylog.info and beautylog.dir
This commit is contained in:
parent
44415e602b
commit
b4e4113550
25
index.js
25
index.js
@ -1,5 +1,6 @@
|
|||||||
/// <reference path="./typings/tsd.d.ts" />
|
/// <reference path="./typings/tsd.d.ts" />
|
||||||
var colors = require("colors");
|
var colors = require("colors");
|
||||||
|
var clc = require("cli-color");
|
||||||
var bl;
|
var bl;
|
||||||
bl = {};
|
bl = {};
|
||||||
/**
|
/**
|
||||||
@ -8,7 +9,9 @@ bl = {};
|
|||||||
*/
|
*/
|
||||||
var localBl;
|
var localBl;
|
||||||
localBl = {};
|
localBl = {};
|
||||||
|
localBl.dirPrefix = clc.bgXterm(39).xterm(231).bold(' DIR ') + ' ';
|
||||||
localBl.errorPrefix = ' Error: '.bgRed.white.bold + ' ';
|
localBl.errorPrefix = ' Error: '.bgRed.white.bold + ' ';
|
||||||
|
localBl.infoPrefix = clc.bgXterm(198).xterm(231).bold(' INFO ') + ' ';
|
||||||
localBl.normalPrefix = ' Log: '.bgCyan.white.bold + ' ';
|
localBl.normalPrefix = ' Log: '.bgCyan.white.bold + ' ';
|
||||||
localBl.okPrefix = ' '.bgGreen + ' OK! '.bgBlack.green.bold + ' ';
|
localBl.okPrefix = ' '.bgGreen + ' OK! '.bgBlack.green.bold + ' ';
|
||||||
localBl.successPrefix = ' Success: '.bgGreen.white.bold + ' ';
|
localBl.successPrefix = ' Success: '.bgGreen.white.bold + ' ';
|
||||||
@ -24,9 +27,15 @@ bl.log = function (logText, logType) {
|
|||||||
if (logType === void 0) { logType = 'normal'; }
|
if (logType === void 0) { logType = 'normal'; }
|
||||||
try {
|
try {
|
||||||
switch (logType) {
|
switch (logType) {
|
||||||
|
case 'dir':
|
||||||
|
logText = localBl.dirPrefix + clc.xterm(26)(logText);
|
||||||
|
break;
|
||||||
case 'error':
|
case 'error':
|
||||||
logText = localBl.errorPrefix + logText.red.bold;
|
logText = localBl.errorPrefix + logText.red.bold;
|
||||||
break;
|
break;
|
||||||
|
case 'info':
|
||||||
|
logText = localBl.infoPrefix + clc.xterm(198)(logText);
|
||||||
|
break;
|
||||||
case 'normal':
|
case 'normal':
|
||||||
logText = localBl.normalPrefix + logText.cyan.bold;
|
logText = localBl.normalPrefix + logText.cyan.bold;
|
||||||
break;
|
break;
|
||||||
@ -51,6 +60,14 @@ bl.log = function (logText, logType) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
/**
|
||||||
|
* logs an directory to console
|
||||||
|
* @param logText
|
||||||
|
* @returns {boolean}
|
||||||
|
*/
|
||||||
|
bl.dir = function (logText) {
|
||||||
|
return bl.log(logText, 'dir');
|
||||||
|
};
|
||||||
/**
|
/**
|
||||||
* logs an error to console
|
* logs an error to console
|
||||||
* @param logText
|
* @param logText
|
||||||
@ -59,6 +76,14 @@ bl.log = function (logText, logType) {
|
|||||||
bl.error = function (logText) {
|
bl.error = function (logText) {
|
||||||
return bl.log(logText, 'error');
|
return bl.log(logText, 'error');
|
||||||
};
|
};
|
||||||
|
/**
|
||||||
|
* logs an info to console
|
||||||
|
* @param logText
|
||||||
|
* @returns {boolean}
|
||||||
|
*/
|
||||||
|
bl.info = function (logText) {
|
||||||
|
return bl.log(logText, 'info');
|
||||||
|
};
|
||||||
/**
|
/**
|
||||||
* logs an 'OK!' message to console
|
* logs an 'OK!' message to console
|
||||||
* @param logText
|
* @param logText
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://github.com/pushrocks/beautylog",
|
"homepage": "https://github.com/pushrocks/beautylog",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"cli-color": "^1.0.0",
|
||||||
"colors": "1.1.2"
|
"colors": "1.1.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
4
test.js
4
test.js
@ -4,14 +4,18 @@ console.log('*** start test ***');
|
|||||||
console.log('');
|
console.log('');
|
||||||
console.log('declarative function calls:');
|
console.log('declarative function calls:');
|
||||||
beautyLog.log('beautylog.log(), with normal logText, without logType');
|
beautyLog.log('beautylog.log(), with normal logText, without logType');
|
||||||
|
beautyLog.dir('beautylog.dir(), with normal logText, without logType');
|
||||||
beautyLog.error('beautylog.error(), with normal logText, without logType');
|
beautyLog.error('beautylog.error(), with normal logText, without logType');
|
||||||
|
beautyLog.info('beautylog.dir(), with normal logText, without logType');
|
||||||
beautyLog.ok('beautylog.ok(), with normal logText, without logType');
|
beautyLog.ok('beautylog.ok(), with normal logText, without logType');
|
||||||
beautyLog.success('beautylog.success(), with normal logText, without logType');
|
beautyLog.success('beautylog.success(), with normal logText, without logType');
|
||||||
beautyLog.warn('beautylog.warn(), with normal logText, without logType');
|
beautyLog.warn('beautylog.warn(), with normal logText, without logType');
|
||||||
console.log('');
|
console.log('');
|
||||||
console.log('logType String:');
|
console.log('logType String:');
|
||||||
beautyLog.log('beautylog.log(), with normal logText, without logType');
|
beautyLog.log('beautylog.log(), with normal logText, without logType');
|
||||||
|
beautyLog.log('beautylog.log(), with normal logText, with logType "dir"', 'dir');
|
||||||
beautyLog.log('beautylog.log(), with normal logText, with logType "error"', 'error');
|
beautyLog.log('beautylog.log(), with normal logText, with logType "error"', 'error');
|
||||||
|
beautyLog.log('beautylog.log(), with normal logText, with logType "info"', 'info');
|
||||||
beautyLog.log('beautylog.log(), with normal logText, with logType "ok"', 'ok');
|
beautyLog.log('beautylog.log(), with normal logText, with logType "ok"', 'ok');
|
||||||
beautyLog.log('beautylog.log(), with normal logText, with logType "success"', 'success');
|
beautyLog.log('beautylog.log(), with normal logText, with logType "success"', 'success');
|
||||||
beautyLog.log('beautylog.log(), with normal logText, with logType "warn"', 'warn');
|
beautyLog.log('beautylog.log(), with normal logText, with logType "warn"', 'warn');
|
||||||
|
25
ts/index.js
25
ts/index.js
@ -1,5 +1,6 @@
|
|||||||
/// <reference path="./typings/tsd.d.ts" />
|
/// <reference path="./typings/tsd.d.ts" />
|
||||||
var colors = require("colors");
|
var colors = require("colors");
|
||||||
|
var clc = require("cli-color");
|
||||||
var bl;
|
var bl;
|
||||||
bl = {};
|
bl = {};
|
||||||
/**
|
/**
|
||||||
@ -8,7 +9,9 @@ bl = {};
|
|||||||
*/
|
*/
|
||||||
var localBl;
|
var localBl;
|
||||||
localBl = {};
|
localBl = {};
|
||||||
|
localBl.dirPrefix = clc.bgXterm(39).xterm(231).bold(' DIR ') + ' ';
|
||||||
localBl.errorPrefix = ' Error: '.bgRed.white.bold + ' ';
|
localBl.errorPrefix = ' Error: '.bgRed.white.bold + ' ';
|
||||||
|
localBl.infoPrefix = clc.bgXterm(198).xterm(231).bold(' INFO ') + ' ';
|
||||||
localBl.normalPrefix = ' Log: '.bgCyan.white.bold + ' ';
|
localBl.normalPrefix = ' Log: '.bgCyan.white.bold + ' ';
|
||||||
localBl.okPrefix = ' '.bgGreen + ' OK! '.bgBlack.green.bold + ' ';
|
localBl.okPrefix = ' '.bgGreen + ' OK! '.bgBlack.green.bold + ' ';
|
||||||
localBl.successPrefix = ' Success: '.bgGreen.white.bold + ' ';
|
localBl.successPrefix = ' Success: '.bgGreen.white.bold + ' ';
|
||||||
@ -24,9 +27,15 @@ bl.log = function (logText, logType) {
|
|||||||
if (logType === void 0) { logType = 'normal'; }
|
if (logType === void 0) { logType = 'normal'; }
|
||||||
try {
|
try {
|
||||||
switch (logType) {
|
switch (logType) {
|
||||||
|
case 'dir':
|
||||||
|
logText = localBl.dirPrefix + clc.xterm(26)(logText);
|
||||||
|
break;
|
||||||
case 'error':
|
case 'error':
|
||||||
logText = localBl.errorPrefix + logText.red.bold;
|
logText = localBl.errorPrefix + logText.red.bold;
|
||||||
break;
|
break;
|
||||||
|
case 'info':
|
||||||
|
logText = localBl.infoPrefix + clc.xterm(198)(logText);
|
||||||
|
break;
|
||||||
case 'normal':
|
case 'normal':
|
||||||
logText = localBl.normalPrefix + logText.cyan.bold;
|
logText = localBl.normalPrefix + logText.cyan.bold;
|
||||||
break;
|
break;
|
||||||
@ -51,6 +60,14 @@ bl.log = function (logText, logType) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
/**
|
||||||
|
* logs an directory to console
|
||||||
|
* @param logText
|
||||||
|
* @returns {boolean}
|
||||||
|
*/
|
||||||
|
bl.dir = function (logText) {
|
||||||
|
return bl.log(logText, 'dir');
|
||||||
|
};
|
||||||
/**
|
/**
|
||||||
* logs an error to console
|
* logs an error to console
|
||||||
* @param logText
|
* @param logText
|
||||||
@ -59,6 +76,14 @@ bl.log = function (logText, logType) {
|
|||||||
bl.error = function (logText) {
|
bl.error = function (logText) {
|
||||||
return bl.log(logText, 'error');
|
return bl.log(logText, 'error');
|
||||||
};
|
};
|
||||||
|
/**
|
||||||
|
* logs an info to console
|
||||||
|
* @param logText
|
||||||
|
* @returns {boolean}
|
||||||
|
*/
|
||||||
|
bl.info = function (logText) {
|
||||||
|
return bl.log(logText, 'info');
|
||||||
|
};
|
||||||
/**
|
/**
|
||||||
* logs an 'OK!' message to console
|
* logs an 'OK!' message to console
|
||||||
* @param logText
|
* @param logText
|
||||||
|
@ -1 +1 @@
|
|||||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,2CAA2C;AAC3C,IAAI,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;AAG/B,IAAI,EAAM,CAAC;AACX,EAAE,GAAG,EAAE,CAAA;AAEP;;;GAGG;AACH,IAAI,OAAW,CAAC;AAChB,OAAO,GAAG,EAAE,CAAC;AACb,OAAO,CAAC,WAAW,GAAG,UAAU,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,GAAI,GAAG,CAAC;AACzD,OAAO,CAAC,YAAY,GAAG,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,GAAI,GAAG,CAAC;AACzD,OAAO,CAAC,QAAQ,GAAG,GAAG,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,GAAI,GAAG,CAAC;AACnE,OAAO,CAAC,aAAa,GAAG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C;AAEF;;;;GAIG;AACH,EAAE,CAAC,IAAI,GAAG,UAAS,OAAO;IACtB,MAAM,CAAC,EAAE,CAAC,GAAG,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;AACnC,CAAC,CAAC;AAEF;;;;GAIG;AACH,EAAE,CAAC,EAAE,GAAG,UAAS,OAAO;IACpB,MAAM,CAAC,EAAE,CAAC,GAAG,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;AACjC,CAAC,CAAC;AAEF;;;;GAIG;AACH,EAAE,CAAC,OAAO,GAAG,UAAS,OAAO;IACzB,MAAM,CAAC,EAAE,CAAC,GAAG,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;AACtC,CAAC,CAAA;AAED;;;;GAIG;AACH,EAAE,CAAC,IAAI,GAAG,UAAS,OAAO;IACtB,MAAM,CAAC,EAAE,CAAC,GAAG,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;AACnC,CAAC,CAAA;AAED,MAAM,CAAC,OAAO,GAAG,EAAE,CAAC"}
|
27
ts/index.ts
27
ts/index.ts
@ -1,5 +1,6 @@
|
|||||||
/// <reference path="./typings/tsd.d.ts" />
|
/// <reference path="./typings/tsd.d.ts" />
|
||||||
var colors = require("colors");
|
var colors = require("colors");
|
||||||
|
var clc = require("cli-color");
|
||||||
|
|
||||||
|
|
||||||
var bl:any;
|
var bl:any;
|
||||||
@ -11,7 +12,9 @@ bl = {}
|
|||||||
*/
|
*/
|
||||||
var localBl:any;
|
var localBl:any;
|
||||||
localBl = {};
|
localBl = {};
|
||||||
|
localBl.dirPrefix = clc.bgXterm(39).xterm(231).bold(' DIR ') + ' ';
|
||||||
localBl.errorPrefix = ' Error: '.bgRed.white.bold + ' ';
|
localBl.errorPrefix = ' Error: '.bgRed.white.bold + ' ';
|
||||||
|
localBl.infoPrefix = clc.bgXterm(198).xterm(231).bold(' INFO ') + ' ';
|
||||||
localBl.normalPrefix = ' Log: '.bgCyan.white.bold + ' ';
|
localBl.normalPrefix = ' Log: '.bgCyan.white.bold + ' ';
|
||||||
localBl.okPrefix = ' '.bgGreen + ' OK! '.bgBlack.green.bold + ' ';
|
localBl.okPrefix = ' '.bgGreen + ' OK! '.bgBlack.green.bold + ' ';
|
||||||
localBl.successPrefix = ' Success: '.bgGreen.white.bold + ' ';
|
localBl.successPrefix = ' Success: '.bgGreen.white.bold + ' ';
|
||||||
@ -26,9 +29,15 @@ localBl.warnPrefix = ' '.bgYellow + ' Warn: '.bgBlack.yellow.bold + ' ';
|
|||||||
bl.log = (logText:string = 'empty log',logType:string = 'normal') => {
|
bl.log = (logText:string = 'empty log',logType:string = 'normal') => {
|
||||||
try {
|
try {
|
||||||
switch (logType) {
|
switch (logType) {
|
||||||
|
case 'dir':
|
||||||
|
logText = localBl.dirPrefix + clc.xterm(26)(logText);
|
||||||
|
break;
|
||||||
case 'error':
|
case 'error':
|
||||||
logText = localBl.errorPrefix + logText.red.bold;
|
logText = localBl.errorPrefix + logText.red.bold;
|
||||||
break;
|
break;
|
||||||
|
case 'info':
|
||||||
|
logText = localBl.infoPrefix + clc.xterm(198)(logText);
|
||||||
|
break;
|
||||||
case 'normal':
|
case 'normal':
|
||||||
logText = localBl.normalPrefix + logText.cyan.bold;
|
logText = localBl.normalPrefix + logText.cyan.bold;
|
||||||
break;
|
break;
|
||||||
@ -54,6 +63,15 @@ bl.log = (logText:string = 'empty log',logType:string = 'normal') => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* logs an directory to console
|
||||||
|
* @param logText
|
||||||
|
* @returns {boolean}
|
||||||
|
*/
|
||||||
|
bl.dir = function(logText) {
|
||||||
|
return bl.log(logText, 'dir');
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* logs an error to console
|
* logs an error to console
|
||||||
@ -64,6 +82,15 @@ bl.error = function(logText) {
|
|||||||
return bl.log(logText, 'error');
|
return bl.log(logText, 'error');
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* logs an info to console
|
||||||
|
* @param logText
|
||||||
|
* @returns {boolean}
|
||||||
|
*/
|
||||||
|
bl.info = function(logText) {
|
||||||
|
return bl.log(logText, 'info');
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* logs an 'OK!' message to console
|
* logs an 'OK!' message to console
|
||||||
* @param logText
|
* @param logText
|
||||||
|
@ -4,14 +4,18 @@ console.log('*** start test ***');
|
|||||||
console.log('');
|
console.log('');
|
||||||
console.log('declarative function calls:');
|
console.log('declarative function calls:');
|
||||||
beautyLog.log('beautylog.log(), with normal logText, without logType');
|
beautyLog.log('beautylog.log(), with normal logText, without logType');
|
||||||
|
beautyLog.dir('beautylog.dir(), with normal logText, without logType');
|
||||||
beautyLog.error('beautylog.error(), with normal logText, without logType');
|
beautyLog.error('beautylog.error(), with normal logText, without logType');
|
||||||
|
beautyLog.info('beautylog.dir(), with normal logText, without logType');
|
||||||
beautyLog.ok('beautylog.ok(), with normal logText, without logType');
|
beautyLog.ok('beautylog.ok(), with normal logText, without logType');
|
||||||
beautyLog.success('beautylog.success(), with normal logText, without logType');
|
beautyLog.success('beautylog.success(), with normal logText, without logType');
|
||||||
beautyLog.warn('beautylog.warn(), with normal logText, without logType');
|
beautyLog.warn('beautylog.warn(), with normal logText, without logType');
|
||||||
console.log('');
|
console.log('');
|
||||||
console.log('logType String:');
|
console.log('logType String:');
|
||||||
beautyLog.log('beautylog.log(), with normal logText, without logType');
|
beautyLog.log('beautylog.log(), with normal logText, without logType');
|
||||||
|
beautyLog.log('beautylog.log(), with normal logText, with logType "dir"', 'dir');
|
||||||
beautyLog.log('beautylog.log(), with normal logText, with logType "error"', 'error');
|
beautyLog.log('beautylog.log(), with normal logText, with logType "error"', 'error');
|
||||||
|
beautyLog.log('beautylog.log(), with normal logText, with logType "info"', 'info');
|
||||||
beautyLog.log('beautylog.log(), with normal logText, with logType "ok"', 'ok');
|
beautyLog.log('beautylog.log(), with normal logText, with logType "ok"', 'ok');
|
||||||
beautyLog.log('beautylog.log(), with normal logText, with logType "success"', 'success');
|
beautyLog.log('beautylog.log(), with normal logText, with logType "success"', 'success');
|
||||||
beautyLog.log('beautylog.log(), with normal logText, with logType "warn"', 'warn');
|
beautyLog.log('beautylog.log(), with normal logText, with logType "warn"', 'warn');
|
||||||
|
@ -1 +1 @@
|
|||||||
{"version":3,"file":"test.js","sourceRoot":"","sources":["test.ts"],"names":[],"mappings":"AAAA,2CAA2C;AAC3C,IAAI,SAAS,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;AAEtC,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;AAClC,OAAO,CAAC,GAAG,CAAE,EAAE,CAAC,CAAC;AAEjB,OAAO,CAAC,GAAG,CAAC,6BAA6B,CAAC,CAAC;AAC3C,SAAS,CAAC,GAAG,CAAC,uDAAuD,CAAC,CAAC;AACvE,SAAS,CAAC,KAAK,CAAC,yDAAyD,CAAC,CAAC;AAC3E,SAAS,CAAC,EAAE,CAAC,sDAAsD,CAAC,CAAC;AACrE,SAAS,CAAC,OAAO,CAAC,2DAA2D,CAAC,CAAC;AAC/E,SAAS,CAAC,IAAI,CAAC,wDAAwD,CAAC,CAAC;AAEzE,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;AAEhB,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;AAC/B,SAAS,CAAC,GAAG,CAAC,uDAAuD,CAAC,CAAC;AACvE,SAAS,CAAC,GAAG,CAAC,4DAA4D,EAAC,OAAO,CAAC,CAAC;AACpF,SAAS,CAAC,GAAG,CAAC,yDAAyD,EAAC,IAAI,CAAC,CAAC;AAC9E,SAAS,CAAC,GAAG,CAAC,8DAA8D,EAAC,SAAS,CAAC,CAAC;AACxF,SAAS,CAAC,GAAG,CAAC,2DAA2D,EAAC,MAAM,CAAC,CAAC;AAElF,OAAO,CAAC,GAAG,CAAE,EAAE,CAAC,CAAC;AACjB,OAAO,CAAC,GAAG,CA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CAAC;AACjB,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC"}
|
@ -6,7 +6,9 @@ console.log ('');
|
|||||||
|
|
||||||
console.log('declarative function calls:');
|
console.log('declarative function calls:');
|
||||||
beautyLog.log('beautylog.log(), with normal logText, without logType');
|
beautyLog.log('beautylog.log(), with normal logText, without logType');
|
||||||
|
beautyLog.dir('beautylog.dir(), with normal logText, without logType');
|
||||||
beautyLog.error('beautylog.error(), with normal logText, without logType');
|
beautyLog.error('beautylog.error(), with normal logText, without logType');
|
||||||
|
beautyLog.info('beautylog.dir(), with normal logText, without logType');
|
||||||
beautyLog.ok('beautylog.ok(), with normal logText, without logType');
|
beautyLog.ok('beautylog.ok(), with normal logText, without logType');
|
||||||
beautyLog.success('beautylog.success(), with normal logText, without logType');
|
beautyLog.success('beautylog.success(), with normal logText, without logType');
|
||||||
beautyLog.warn('beautylog.warn(), with normal logText, without logType');
|
beautyLog.warn('beautylog.warn(), with normal logText, without logType');
|
||||||
@ -15,7 +17,9 @@ console.log('');
|
|||||||
|
|
||||||
console.log('logType String:');
|
console.log('logType String:');
|
||||||
beautyLog.log('beautylog.log(), with normal logText, without logType');
|
beautyLog.log('beautylog.log(), with normal logText, without logType');
|
||||||
|
beautyLog.log('beautylog.log(), with normal logText, with logType "dir"','dir');
|
||||||
beautyLog.log('beautylog.log(), with normal logText, with logType "error"','error');
|
beautyLog.log('beautylog.log(), with normal logText, with logType "error"','error');
|
||||||
|
beautyLog.log('beautylog.log(), with normal logText, with logType "info"','info');
|
||||||
beautyLog.log('beautylog.log(), with normal logText, with logType "ok"','ok');
|
beautyLog.log('beautylog.log(), with normal logText, with logType "ok"','ok');
|
||||||
beautyLog.log('beautylog.log(), with normal logText, with logType "success"','success');
|
beautyLog.log('beautylog.log(), with normal logText, with logType "success"','success');
|
||||||
beautyLog.log('beautylog.log(), with normal logText, with logType "warn"','warn');
|
beautyLog.log('beautylog.log(), with normal logText, with logType "warn"','warn');
|
||||||
|
Loading…
Reference in New Issue
Block a user