update to version 2

This commit is contained in:
Philipp Kunz 2016-10-16 02:26:43 +02:00
parent 8aa178e576
commit 80799156ab
32 changed files with 457 additions and 601 deletions

View File

@ -20,14 +20,14 @@ beautiful logging, TypeScript ready
## Usage
```typescript
var beautylog = require("beautylog");
import * as beautylog from 'beautylog'
beautylog.log("some log message"); // normal console log message
beautylog.info("some log message") // info console log message
beautylog.ok("some log message"); // ok console log message
beautylog.warn("some log message"); // warn console log message
beautylog.success("some success message"); // success console log message
beautylog.error("some error message"); // error console log message
beautylog.log('some log message') // normal console log message
beautylog.info('some log message') // info console log message
beautylog.ok('some log message') // ok console log message
beautylog.warn('some log message') // warn console log message
beautylog.success('some success message') // success console log message
beautylog.error('some error message') // error console log message
```
The plugin produces beautiful output like this:
![console.png](https://mediaserve.lossless.digital/github.com/pushrocks/beautylog/console.png)
@ -36,46 +36,14 @@ The plugin produces beautiful output like this:
beautylog wraps the excellent ora module from npm to better work with beautylog. In general that means that you can log persistent messages WHILE you are actually having an active Ora object. beautylog handles all the fuss for you.
```typescript
var myOra = new beautylog.Ora("my awesome text", "blue");
myOra.start();
beautylog.info("some persistent text") //does not disturb myOra
console.log("something") // even this works because console.log is monkeypatched by beautylog
myOra.text("some updated text");
myOra.stop();
let myOra = new beautylog.Ora('my awesome text', 'blue')
myOra.start()
beautylog.info('some persistent text') //does not disturb myOra
console.log('something') // even this works because console.log is monkeypatched by beautylog
myOra.text('some updated text')
myOra.stop()
```
### Console Tables
beautylog allows displaying data in nice tables for better overview.
> **Note:** This only works only in nodejs for now.
There are different types of tables.
#### Custom
```javascript
var beautylog = require("beautylog");
var myTable = beautylog.table.new("custom",["Heading1".blue,"Heading2".blue,"Heading3".blue]); // type "custom"
myTable.push(["check 1","success"]); // adds a row the myTable
myTable.push(["check 2","error"]); // adds a row the myTable
myTable.push(["check 3","error"]); // adds a row the myTable
myTable.print(); //prints myTable to the console
```
#### Checks
```javascript
var beautylog = require("beautylog");
var myTable = beautylog.table.new("checks"); // type checks
myTable.push(["check 1","success"]); // adds a row to myTable
myTable.push(["check 2","error"]); // adds a row to myTable
myTable.push(["check 3","error"]); // adds a row to myTable
myTable.print(); //prints myTable to 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)
## Centralized remote logging
Beautylog makes it easy to have all your node applications log to a remote location.
@ -85,11 +53,11 @@ Currently supported remote providers:
```typescript
beautylog.remote.loggly({
token: "loggly-token",
subdomain: "loggly-subdomain",
appName: "some App Name",
serverName: "some Server Name"
});
token: 'loggly-token',
subdomain: 'loggly-subdomain',
appName: 'some App Name',
serverName: 'some Server Name'
})
```
> Note: since beautylog monkeypatches all console log methods.

View File

@ -1,9 +1,9 @@
import "typings-global";
import 'typings-global';
export declare let oraActive: boolean;
export declare let activeOra: Ora;
export declare class Ora {
private _oraObject;
state: string;
private _oraObject;
constructor(textArg: string, colorArg: string, startArg?: boolean);
text(textArg: any): void;
start(textArg?: string, colorArg?: string): void;

View File

@ -2,11 +2,11 @@
require("typings-global");
const plugins = require("./beautylog.plugins");
const beautylog_log_helpers_1 = require("./beautylog.log.helpers");
exports.oraActive = false; // when an Ora is active (e.g. start()) this is true;
exports.oraActive = false; // when an Ora is active (e.g. start()) this is true
class Ora {
constructor(textArg, colorArg, startArg = false) {
this._oraObject = plugins.ora({
spinner: "dots",
spinner: 'dots',
text: textArg,
color: colorArg
});
@ -15,17 +15,17 @@ class Ora {
text(textArg) {
this._oraObject.text = textArg;
}
;
start(textArg, colorArg) {
if (textArg)
if (textArg) {
this._oraObject.text = textArg;
if (colorArg)
}
if (colorArg) {
this._oraObject.color = colorArg;
}
exports.activeOra = this;
exports.oraActive = true;
this._oraObject.start();
}
;
end() {
this._oraObject.stop();
this._oraObject.clear();
@ -34,21 +34,18 @@ class Ora {
}
endOk(textArg) {
this.end();
beautylog_log_helpers_1.logNode("ok", textArg);
beautylog_log_helpers_1.logNode('ok', textArg);
}
;
endError(textArg) {
this.end();
beautylog_log_helpers_1.logNode("error", textArg);
beautylog_log_helpers_1.logNode('error', textArg);
}
;
pause() {
this._oraObject.stop();
}
stop() {
this.end();
}
;
}
exports.Ora = Ora;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYmVhdXR5bG9nLmNsYXNzZXMub3JhLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvYmVhdXR5bG9nLmNsYXNzZXMub3JhLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSxRQUFPLGdCQUFnQixDQUFDLENBQUE7QUFDeEIsTUFBWSxPQUFPLFdBQU0scUJBQXFCLENBQUMsQ0FBQTtBQUMvQyx3Q0FBc0IseUJBQXlCLENBQUMsQ0FBQTtBQUVyQyxpQkFBUyxHQUFXLEtBQUssQ0FBQyxDQUFDLHFEQUFxRDtBQUczRjtJQUdJLFlBQVksT0FBYyxFQUFDLFFBQWUsRUFBQyxRQUFRLEdBQVcsS0FBSztRQUMvRCxJQUFJLENBQUMsVUFBVSxHQUFHLE9BQU8sQ0FBQyxHQUFHLENBQUM7WUFDMUIsT0FBTyxFQUFDLE1BQU07WUFDZCxJQUFJLEVBQUMsT0FBTztZQUNaLEtBQUssRUFBQyxRQUFRO1NBQ2pCLENBQUMsQ0FBQztRQUVILFFBQVEsR0FBRyxJQUFJLENBQUMsVUFBVSxDQUFDLEtBQUssRUFBRSxHQUFHLEtBQUksQ0FBQyxDQUFDLENBQUMsQ0FBQztJQUNqRCxDQUFDO0lBQ0QsSUFBSSxDQUFDLE9BQU87UUFDUixJQUFJLENBQUMsVUFBVSxDQUFDLElBQUksR0FBRyxPQUFPLENBQUM7SUFDbkMsQ0FBQzs7SUFFRCxLQUFLLENBQUMsT0FBZSxFQUFDLFFBQWdCO1FBQ2xDLEVBQUUsQ0FBQSxDQUFDLE9BQU8sQ0FBQztZQUFDLElBQUksQ0FBQyxVQUFVLENBQUMsSUFBSSxHQUFHLE9BQU8sQ0FBQzt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QUMzQixDQUFDO0lBQ0QsR0FBRztRQUNDLElBQUksQ0FBQyxVQUFVLENBQUMsSUFBSSxFQUFFLENBQUE7UUFDdEIsSUFBSSxDQUFDLFVBQVUsQ0FBQyxLQUFLLEVBQUUsQ0FBQTtRQUN2QixpQkFBUyxHQUFHLFNBQVMsQ0FBQTtRQUNyQixpQkFBUyxHQUFHLEtBQUssQ0FBQTtJQUNyQixDQUFDO0lBQ0QsS0FBSyxDQUFDLE9BQU87UUFDVCxJQUFJLENBQUMsR0FBRyxFQUFFLENBQUE7UUFDViwrQkFBTyxDQUFDLElBQUksRUFBQyxPQUFPLENBQUMsQ0FBQTtJQUN6QixDQUFDO0lBQ0QsUUFBUSxDQUFDLE9BQU87UUFDWixJQUFJLENBQUMsR0FBRyxFQUFFLENBQUE7UUFDViwrQkFBTyxDQUFDLE9BQU8sRUFBQyxPQUFPLENBQUMsQ0FBQTtJQUM1QixDQUFDO0lBQ0QsS0FBSztRQUNELElBQUksQ0FBQyxVQUFVLENBQUMsSUFBSSxFQUFFLENBQUE7SUFDMUIsQ0FBQztJQUNELElBQUk7UUFDQSxJQUFJLENBQUMsR0FBRyxFQUFFLENBQUE7SUFDZCxDQUFDO0NBQ0o7QUEzQ0Qsa0JBMkNDIn0=

View File

@ -1,9 +0,0 @@
import "typings-global";
export declare class Table {
tableHead: string[];
rows: any;
type: string;
constructor(tableTypeArg: string, tableHeadArrayArg?: string[]);
push(row: string[]): void;
print(): void;
}

View File

@ -1,49 +0,0 @@
"use strict";
require("typings-global");
const plugins = require("./beautylog.plugins");
let tableHelpers = {
makeRow: function (cellCounterArg = 2, colorArg = "cyan") {
let rowArray = [];
for (let i = 0; i < (cellCounterArg); i++) {
rowArray.push(String(i + 1).cyan);
}
return rowArray;
}
};
class Table {
constructor(tableTypeArg, tableHeadArrayArg = tableHelpers.makeRow()) {
switch (tableTypeArg) {
case "checks":
this.tableHead = ['Check Item:'.cyan, 'Status:'.cyan];
break;
case "custom":
this.tableHead = tableHeadArrayArg;
break;
default:
break;
}
this.rows = [];
this.type = tableTypeArg;
}
push(row) {
this.rows.push(row);
}
print() {
let table = new plugins.cliTable({
head: this.tableHead
});
for (let 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());
}
}
exports.Table = Table;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYmVhdXR5bG9nLmNsYXNzZXMudGFibGUuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9iZWF1dHlsb2cuY2xhc3Nlcy50YWJsZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsUUFBTyxnQkFBZ0IsQ0FBQyxDQUFBO0FBQ3hCLE1BQVksT0FBTyxXQUFNLHFCQUFxQixDQUFDLENBQUE7QUFFL0MsSUFBSSxZQUFZLEdBQUc7SUFDZixPQUFPLEVBQUUsVUFBUyxjQUFjLEdBQVUsQ0FBQyxFQUFDLFFBQVEsR0FBVSxNQUFNO1FBQ2hFLElBQUksUUFBUSxHQUFHLEVBQUUsQ0FBQztRQUNsQixHQUFHLENBQUMsQ0FBQyxJQUFJLENBQUMsR0FBRyxDQUFDLEVBQUUsQ0FBQyxHQUFHLENBQUMsY0FBYyxDQUFDLEVBQUUsQ0FBQyxFQUFFLEVBQUUsQ0FBQztZQUN4QyxRQUFRLENBQUMsSUFBSSxDQUFDLE1BQU0sQ0FBQyxDQUFDLEdBQUcsQ0FBQyxDQUFDLENBQUMsSUFBSSxDQUFDLENBQUM7UUFDdEMsQ0FBQztRQUNELE1BQU0sQ0FBQyxRQUFRLENBQUM7SUFDcEIsQ0FBQztDQUNKLENBQUM7QUFFRjtJQUlJLFlBQVksWUFBbUIsRUFBQyxpQkFBaUIsR0FBWSxZQUFZ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QUksQ0FBQyxHQUFHLENBQUMsQ0FBQyxDQUFDLENBQUMsQ0FBQztZQUM5RCxDQUFDO1lBQUMsSUFBSSxDQUFDLEVBQUUsQ0FBQyxDQUFDLElBQUksQ0FBQyxJQUFJLENBQUMsR0FBRyxDQUFDLENBQUMsQ0FBQyxDQUFDLElBQUksT0FBTyxDQUFDLENBQUMsQ0FBQztnQkFDdEMsSUFBSSxDQUFDLElBQUksQ0FBQyxHQUFHLENBQUMsQ0FBQyxDQUFDLENBQUMsR0FBRyxHQUFHLENBQUMsS0FBSyxHQUFHLEdBQUcsR0FBRyxJQUFJLENBQUMsSUFBSSxDQUFDLEdBQUcsQ0FBQyxDQUFDLENBQUMsQ0FBQyxDQUFDO1lBQzVELENBQUM7WUFDRCxLQUFLLENBQUMsSUFBSSxDQUFDLElBQUksQ0FBQyxJQUFJLENBQUMsR0FBRyxDQUFDLENBQUMsQ0FBQztRQUMvQixDQUFDO1FBQUEsQ0FBQztRQUNGLE9BQU8sQ0FBQyxHQUFHLENBQUMsS0FBSyxDQUFDLFFBQVEsRUFBRSxDQUFDLENBQUM7SUFDbEMsQ0FBQztBQUNMLENBQUM7QUFuQ1ksYUFBSyxRQW1DakIsQ0FBQSJ9

View File

@ -1,4 +1,4 @@
import "typings-global";
import 'typings-global';
export declare let beautyConsole: {
log: (logArg: any) => void;
error: () => void;

View File

@ -38,4 +38,4 @@ exports.beautyConsole = {
}
};
route(true);
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYmVhdXR5bG9nLmNvbnNvbGUuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9iZWF1dHlsb2cuY29uc29sZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsUUFBTyxnQkFBZ0IsQ0FBQyxDQUFBO0FBRXhCLHdDQUFrQyx5QkFBeUIsQ0FBQyxDQUFBO0FBQzVELElBQUksU0FBUyxHQUFHLE9BQU8sQ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ZQUNWLGlDQUFTLENBQUMsS0FBSyxFQUFFLENBQUE7WUFDakIsU0FBUyxDQUFDLEtBQUssQ0FBQyxTQUFTLEVBQUUsU0FBUyxDQUFDLENBQUE7WUFDckMsaUNBQVMsQ0FBQyxLQUFLLEVBQUUsQ0FBQTtRQUNyQixDQUFDO1FBQUMsSUFBSSxDQUFDLENBQUM7WUFDSixTQUFTLENBQUMsS0FBSyxDQUFDLFNBQVMsRUFBRSxTQUFTLENBQUMsQ0FBQTtRQUN6QyxDQUFDO0lBQ0wsQ0FBQztJQUNELEtBQUssRUFBRTtRQUNILEVBQUUsQ0FBQSxDQUFDLGlDQUFTLENBQUMsQ0FBQSxDQUFDO1lBQ1YsaUNBQVMsQ0FBQyxLQUFLLEVBQUUsQ0FBQTtZQUNqQixTQUFTLENBQUMsS0FBSyxDQUFDLFdBQVcsRUFBRSxTQUFTLENBQUMsQ0FBQTtZQUN2QyxpQ0FBUyxDQUFDLEtBQUssRUFBRSxDQUFBO1FBQ3JCLENBQUM7UUFBQyxJQUFJLENBQUMsQ0FBQztZQUNKLFNBQVMsQ0FBQyxLQUFLLENBQUMsV0FBVyxFQUFFLFNBQVMsQ0FBQyxDQUFBO1FBQzNDLENBQUM7SUFDTCxDQUFDO0NBQ0osQ0FBQTtBQUVELEtBQUssQ0FBQyxJQUFJLENBQUMsQ0FBQSJ9

View File

@ -1,5 +1,4 @@
/// <reference types="q" />
import "typings-global";
import plugins = require("./beautylog.plugins");
export declare var figlet: (textArg: string, optionsArg?: any) => plugins.q.Promise<{}>;
export declare var figletSync: (textArg: string, optionsArg?: any) => boolean;
import 'typings-global';
export declare let figlet: (textArg: string, optionsArg?: any) => Q.Promise<{}>;
export declare let figletSync: (textArg: string, optionsArg?: any) => boolean;

View File

@ -1,15 +1,15 @@
"use strict";
require("typings-global");
const plugins = require("./beautylog.plugins");
var defaultOptions = {
font: "Star Wars",
color: "green",
let defaultOptions = {
font: 'Star Wars',
color: 'green',
cb: function () { }
};
exports.figlet = function (textArg, optionsArg) {
var done = plugins.q.defer();
var mergeOptions = plugins.lodash.cloneDeep(defaultOptions);
var options = plugins.lodash.assign(mergeOptions, optionsArg);
let done = plugins.q.defer();
let mergeOptions = plugins.lodash.cloneDeep(defaultOptions);
let options = plugins.lodash.assign(mergeOptions, optionsArg);
plugins.figlet(textArg, {
font: options.font,
horizontalLayout: 'default',
@ -27,8 +27,8 @@ exports.figlet = function (textArg, optionsArg) {
return done.promise;
};
exports.figletSync = function (textArg, optionsArg) {
var mergeOptions = plugins.lodash.cloneDeep(defaultOptions);
var options = plugins.lodash.assign(mergeOptions, optionsArg);
let mergeOptions = plugins.lodash.cloneDeep(defaultOptions);
let options = plugins.lodash.assign(mergeOptions, optionsArg);
console.log(plugins.figlet.textSync(textArg, {
font: options.font,
horizontalLayout: 'default',
@ -36,4 +36,4 @@ exports.figletSync = function (textArg, optionsArg) {
})[options.color]);
return true;
};
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYmVhdXR5bG9nLmZpZ2xldC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL2JlYXV0eWxvZy5maWdsZXQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLFFBQU8sZ0JBQWdCLENBQUMsQ0FBQTtBQUN4QixNQUFPLE9BQU8sV0FBVyxxQkFBcUIsQ0FBQyxDQUFDO0FBQ2hELElBQUksY0FBYyxHQUFHO0lBQ2pCLElBQUksRUFBQyxXQUFXO0lBQ2hCLEtBQUssRUFBRSxPQUFPO0lBQ2QsRUFBRSxFQUFFLGNBQVcsQ0FBQztDQUNuQixDQUFDO0FBRVMsY0FBTSxHQUFHLFVBQVMsT0FBYyxFQUFDLFVBQVc7SUFDbkQsSUFBSSxJQUFJLEdBQUcsT0FBTyxDQUFDLENBQUMsQ0FBQyxLQUFLLEVBQUUsQ0FBQztJQUM3QixJQUFJLFlBQVksR0FBRyxPQUFPLENBQUMs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VCLENBQUMsQ0FBQyxPQUFPLENBQUMsS0FBSyxDQUFDLENBQUMsQ0FBQTtJQUNsQixNQUFNLENBQUMsSUFBSSxDQUFBO0FBQ2YsQ0FBQyxDQUFBIn0=

View File

@ -1,4 +1,4 @@
import "typings-global";
import 'typings-global';
/**
* logs an info to console
* @param logText

File diff suppressed because one or more lines are too long

20
dist/beautylog.log.js vendored
View File

@ -7,7 +7,7 @@ const beautylog_log_helpers_1 = require("./beautylog.log.helpers");
* @returns {boolean}
*/
exports.log = (logText) => {
return beautylog_log_helpers_1.internalLog("log", logText);
return beautylog_log_helpers_1.internalLog('log', logText);
};
exports.info = (logText) => {
return beautylog_log_helpers_1.internalLog('info', logText);
@ -18,7 +18,7 @@ exports.info = (logText) => {
* @returns {boolean}
*/
exports.ok = (logText) => {
return beautylog_log_helpers_1.internalLog("ok", logText);
return beautylog_log_helpers_1.internalLog('ok', logText);
};
/**
* logs a success to console
@ -26,7 +26,7 @@ exports.ok = (logText) => {
* @returns {boolean}
*/
exports.success = (logText) => {
return beautylog_log_helpers_1.internalLog("success", logText);
return beautylog_log_helpers_1.internalLog('success', logText);
};
/**
* logs a 'warn:' message to console
@ -34,7 +34,7 @@ exports.success = (logText) => {
* @returns {boolean}
*/
exports.warn = (logText) => {
return beautylog_log_helpers_1.internalLog("warn", logText);
return beautylog_log_helpers_1.internalLog('warn', logText);
};
/**
* logs an error to console
@ -42,7 +42,7 @@ exports.warn = (logText) => {
* @returns {boolean}
*/
exports.error = (logText) => {
return beautylog_log_helpers_1.internalLog("error", logText);
return beautylog_log_helpers_1.internalLog('error', logText);
};
/**
* logs an directory to console
@ -50,7 +50,7 @@ exports.error = (logText) => {
* @returns {boolean}
*/
exports.dir = (logText) => {
return beautylog_log_helpers_1.internalLog("dir", logText);
return beautylog_log_helpers_1.internalLog('dir', logText);
};
/**
* creates a new empty line
@ -59,14 +59,14 @@ exports.dir = (logText) => {
*/
exports.newLine = (linesArg = 1) => {
for (let i = 0; i < linesArg; i++) {
console.log("\n");
console.log('\n');
}
};
/**
* logs a reduced log that only logs changes of consequential log messages
*/
exports.logReduced = (logTextArg, repeatEveryTimesArg = 0) => {
if (logTextArg == previousMessage && (repeatEveryTimesArg == 0 || sameMessageCounter != repeatEveryTimesArg)) {
if (logTextArg === previousMessage && (repeatEveryTimesArg === 0 || sameMessageCounter != repeatEveryTimesArg)) {
sameMessageCounter++;
}
else {
@ -75,6 +75,6 @@ exports.logReduced = (logTextArg, repeatEveryTimesArg = 0) => {
exports.log(logTextArg);
}
};
let previousMessage = "";
let previousMessage = '';
let sameMessageCounter = 0;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYmVhdXR5bG9nLmxvZy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL2JlYXV0eWxvZy5sb2cudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLFFBQU8sZ0JBQWdCLENBQUMsQ0FBQTtBQUV4Qix3Q0FBMEIseUJBQXlCLENBQUMsQ0FBQTtBQUVwRDs7OztHQUlHO0FBRVEsV0FBRyxHQUFHLENBQUMsT0FBTztJQUNyQixNQUFNLENBQUMsbUNBQVcsQ0FBQyxLQUFLLEVBQUMsT0FBTyxDQUFDLENBQUE7QUFDckMsQ0FBQyxDQUFBO0FBRVUsWUFBSSxHQUFHLENBQUMsT0FBTztJQUN0QixNQUFNLENBQUMsbUNBQVcsQ0FBQyxNQUFNLEVBQUMsT0FBTyxDQUFDLENBQUM7QUFDdkMsQ0FBQyxDQUFDO0FBRUY7Ozs7R0FJRztBQUNRLFVBQUUsR0FBRyxDQUFDLE9BQU87SUFDcEIsTUFBTSxDQUFDLG1DQUFXLENBQUMsSUFBSSxFQUFDLE9BQU8sQ0FBQyxDQUFDO0FBQ3JDLENBQUMsQ0FBQztBQUVGOzs7O0dBSUc7QUFDUSxlQUFPLEdBQUcsQ0FBQyxPQUFPO0lBQ3pCLE1BQU0sQ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UMsQ0FBQztRQUNKLGtCQUFrQixHQUFHLENBQUMsQ0FBQTtRQUN0QixlQUFlLEdBQUcsVUFBVSxDQUFBO1FBQzVCLFdBQUcsQ0FBQyxVQUFVLENBQUMsQ0FBQTtJQUNuQixDQUFDO0FBQ0wsQ0FBQyxDQUFBO0FBQ0QsSUFBSSxlQUFlLEdBQVcsRUFBRSxDQUFBO0FBQ2hDLElBQUksa0JBQWtCLEdBQVcsQ0FBQyxDQUFBIn0=

View File

@ -1,10 +1,9 @@
import "typings-global";
export import lodash = require("lodash");
export import smartenv = require("smartenv");
export import q = require("q");
export declare let cliTable: any;
export import colors = require("colors");
export declare let clc: any;
export declare let figlet: any;
export import loggly = require("loggly");
export declare let ora: any;
import 'typings-global';
import * as lodash from 'lodash';
import * as smartenv from 'smartenv';
import * as q from 'q';
import * as clc from 'cli-color';
declare let figlet: any;
import * as loggly from 'loggly';
declare let ora: any;
export { lodash, smartenv, q, clc, figlet, loggly, ora };

View File

@ -1,12 +1,17 @@
"use strict";
require("typings-global");
exports.lodash = require("lodash");
exports.smartenv = require("smartenv");
exports.q = require("q");
exports.cliTable = require("cli-table2");
exports.colors = require("colors");
exports.clc = require("cli-color");
exports.figlet = require("figlet");
exports.loggly = require("loggly");
exports.ora = require("ora");
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYmVhdXR5bG9nLnBsdWdpbnMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9iZWF1dHlsb2cucGx1Z2lucy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsUUFBTyxnQkFBZ0IsQ0FBQyxDQUFBO0FBRVYsY0FBTSxXQUFXLFFBQVEsQ0FBQyxDQUFDO0FBQzNCLGdCQUFRLFdBQVcsVUFBVSxDQUFDLENBQUM7QUFDL0IsU0FBQyxXQUFXLEdBQUcsQ0FBQyxDQUFBO0FBQ25CLGdCQUFRLEdBQUcsT0FBTyxDQUFDLFlBQVksQ0FBQyxDQUFDO0FBQzlCLGNBQU0sV0FBVyxRQUFRLENBQUMsQ0FBQztBQUM5QixXQUFHLEdBQUcsT0FBTyxDQUFDLFdBQVcsQ0FBQyxDQUFDO0FBQzNCLGNBQU0sR0FBRyxPQUFPLENBQUMsUUFBUSxDQUFDLENBQUM7QUFDeEIsY0FBTSxXQUFXLFFBQVEsQ0FBQyxDQUFDO0FBQzlCLFdBQUcsR0FBRyxPQUFPLENBQUMsS0FBSyxDQUFDLENBQUMifQ==
const lodash = require("lodash");
exports.lodash = lodash;
const smartenv = require("smartenv");
exports.smartenv = smartenv;
const q = require("q");
exports.q = q;
const clc = require("cli-color");
exports.clc = clc;
let figlet = require('figlet');
exports.figlet = figlet;
const loggly = require("loggly");
exports.loggly = loggly;
let ora = require('ora');
exports.ora = ora;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYmVhdXR5bG9nLnBsdWdpbnMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9iZWF1dHlsb2cucGx1Z2lucy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsMEJBQXdCO0FBRXhCLGlDQUFnQztBQVM1QixpQkFUUSxNQUFNLENBU1I7QUFSVixxQ0FBb0M7QUFTaEMsbUJBVFEsUUFBUSxDQVNSO0FBUlosdUJBQXNCO0FBU2xCLFlBVFEsQ0FBQyxDQVNSO0FBUkwsaUNBQWdDO0FBUzVCLGNBVFEsR0FBRyxDQVNSO0FBUlAsSUFBSSxNQUFNLEdBQUcsT0FBTyxDQUFDLFFBQVEsQ0FBQyxDQUFBO0FBUzFCLGlCQVRBLE1BQU0sQ0FTQTtBQVJWLGlDQUFnQztBQVM1QixpQkFUUSxNQUFNLENBU1I7QUFSVixJQUFJLEdBQUcsR0FBRyxPQUFPLENBQUMsS0FBSyxDQUFDLENBQUE7QUFTcEIsY0FUQSxHQUFHLENBU0EifQ==

View File

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UsVUFBVSxDQUFDLEtBQUs7UUFDdkIsU0FBUyxFQUFFLFVBQVUsQ0FBQyxTQUFTO1FBQy9CLElBQUksRUFBRSxFQUFFO1FBQ1IsSUFBSSxFQUFFLElBQUk7S0FDYixDQUFDLENBQUM7SUFDSCxVQUFVLENBQUMsZUFBZSxHQUFHLFVBQVUsQ0FBQyxPQUFPLENBQUM7SUFDaEQsVUFBVSxDQUFDLFVBQVUsR0FBRyxVQUFVLENBQUMsVUFBVSxDQUFDO0FBQ2xELENBQUMsQ0FBQTtBQUVVLFFBQUEsTUFBTSxHQUFHO0lBQ2hCLE1BQU0sRUFBRSxNQUFNO0NBQ2pCLENBQUMifQ==

1
dist/index.d.ts vendored
View File

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

4
dist/index.js vendored
View File

@ -1,8 +1,6 @@
"use strict";
require("typings-global");
// export classes
var beautylog_classes_table_1 = require("./beautylog.classes.table");
exports.Table = beautylog_classes_table_1.Table;
var beautylog_classes_ora_1 = require("./beautylog.classes.ora");
exports.Ora = beautylog_classes_ora_1.Ora;
// export methods
@ -21,4 +19,4 @@ exports.figlet = beautylog_figlet_1.figlet;
exports.figletSync = beautylog_figlet_1.figletSync;
var beautylog_remote_1 = require("./beautylog.remote");
exports.remote = beautylog_remote_1.remote;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsUUFBTyxnQkFBZ0IsQ0FBQyxDQUFBO0FBSXhCLGlCQUFpQjtBQUNqQix3Q0FBb0IsMkJBQTJCLENBQUM7QUFBeEMsZ0RBQXdDO0FBQ2hELHNDQUFr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@types/colors": "0.x.x",
"@types/lodash": "4.x.x",
"@types/loggly": "1.x.x",
"@types/loggly": "^1.1.30",
"@types/q": "0.x.x",
"cli-color": "^1.1.0",
"cli-table2": "^0.2.0",
"colors": "1.1.2",
"figlet": "^1.1.2",
"lodash": "^4.15.0",
"loggly": "^1.1.0",
"figlet": "^1.2.0",
"lodash": "^4.16.4",
"loggly": "^1.1.1",
"ora": "^0.3.0",
"q": "^1.4.1",
"smartenv": "^1.2.5",
"typings-global": "^1.0.13"
"typings-global": "^1.0.14"
},
"devDependencies": {
"npmts-g": "^5.2.8",
"typings-test": "^1.0.2"
"typings-test": "^1.0.3"
}
}

2
test/test.d.ts vendored
View File

@ -1 +1 @@
import "typings-test";
import 'typings-test';

View File

@ -1,102 +1,88 @@
"use strict";
require("typings-test");
const beautylog = require('../dist/index');
describe("beautylog", function () {
describe(".log(message)", function () {
it("should print a blue Dir message", function () {
const beautylog = require("../dist/index");
describe('beautylog', function () {
describe('.log(message)', function () {
it('should print a blue Dir message', function () {
beautylog.log('beautylog.log(), with normal logText, without logType');
});
});
describe(".dir(message)", function () {
it("should print a blue Dir message", function () {
describe('.dir(message)', function () {
it('should print a blue Dir message', function () {
beautylog.dir('beautylog.dir(), with normal logText, without logType');
});
});
describe(".error(message)", function () {
it("should print a red error message", function () {
describe('.error(message)', function () {
it('should print a red error message', function () {
beautylog.error('beautylog.error(), with normal logText, without logType');
});
});
describe(".figlet", function () {
it("should print nice fonts to console in yellow", function (done) {
beautylog.figlet("Async!", { font: "Star Wars", color: "yellow" }).then(done);
describe('.figlet', function () {
it('should print nice fonts to console in yellow', function (done) {
beautylog.figlet('Async!', { font: 'Star Wars', color: 'yellow' }).then(done);
});
});
describe(".figletSync", function () {
it("should print nice fonts to console in yellow", function () {
beautylog.figletSync("Sync!", { font: "Star Wars", color: "blue" });
describe('.figletSync', function () {
it('should print nice fonts to console in yellow', function () {
beautylog.figletSync('Sync!', { font: 'Star Wars', color: 'blue' });
});
});
describe(".info(message)", function () {
it("should display a purple info message", function () {
describe('.info(message)', function () {
it('should display a purple info message', 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('.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 () {
describe('.ok(message)', function () {
it('should display a green ok message', function () {
beautylog.ok('beautylog.ok(), with normal logText, without logType');
});
});
describe(".newLine(number)", function () {
it("create specified amount of new lines", function () {
describe('.newLine(number)', function () {
it('create specified amount of new lines', function () {
beautylog.newLine(1);
});
});
describe(".ora(text,color)", function () {
it("should display, update, and end a message", function (done) {
describe('.ora(text,color)', function () {
it('should display, update, and end a message', function (done) {
this.timeout(10000);
let testOra = new beautylog.Ora("This is a test text", "green", true);
let testOra = new beautylog.Ora('This is a test text', 'green', true);
setTimeout(function () {
testOra.text("updated text!");
beautylog.info("another log message that uses the normal log function");
testOra.text('updated text!');
beautylog.info('another log message that uses the normal log function');
setTimeout(function () {
testOra.endOk("Allright, ora works!");
testOra.endOk('Allright, ora works!');
done();
}, 2000);
}, 2000);
});
it("should display an error message when ended with error", function (done) {
it('should display an error message when ended with error', function (done) {
this.timeout(10000);
let testOra = new beautylog.Ora("This is another test text", "green");
let testOra = new beautylog.Ora('This is another test text', 'green');
setTimeout(function () {
testOra.endError("Allright, ora displays an error!");
testOra.endError('Allright, ora displays an error!');
done();
}, 2000);
});
});
describe(".success(message)", function () {
it("should display an orange warn message", function () {
describe('.success(message)', function () {
it('should display an orange warn message', function () {
beautylog.success('beautylog.success(), with normal logText, without logType');
});
});
describe(".warn", function () {
it("should display a orange warn message", function () {
describe('.warn', function () {
it('should display a orange warn message', function () {
beautylog.warn('beautylog.warn(), with normal logText, without logType');
});
});
describe(".Table", function () {
it("should print a nice table", function () {
(function () {
var testTable1 = new beautylog.Table("checks");
testTable1.push(['check1', 'success']);
testTable1.push(['check2', 'error']);
testTable1.push(['check3', 'error']);
testTable1.print();
var testTable2 = new beautylog.Table("custom", ["Column1".red, "Column2".blue, "Column3".cyan]);
testTable2.push(["Hey", "this", "works"]);
testTable2.print();
})();
});
});
});
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGVzdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbInRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLFFBQU8sY0FBYyxDQUFDLENBQUE7QUFDdEIsTUFBTyxTQUFTLFdBQVcsZUFBZSxDQUFDLENBQUM7QUFFNUMsUUFBUSxDQUFDLFdBQVcsRUFBQztJQUNqQixRQUFRLENBQUMsZUFBZSxFQUFDO1FBQ3JCLEVBQUUsQ0FBQyxpQ0FBaUMsRUFBQztZQUNqQyxTQUFTLENBQUMsR0FBRyxDQUFDLHVEQUF1RCxDQUFDLENBQUM7UUFDM0UsQ0FBQyxDQUFDLENBQUE7SUFDTixDQUFDLENBQUMsQ0FBQTtJQUNGLFFBQVEsQ0FBQyxlQUFlLEVBQUM7UUFDckIsRUFBRSxDQUFDLGlDQUFpQyxFQUFDO1lBQ2pDLFNBQVMsQ0FBQyxHQUFHLENBQUMsdURBQXVELENBQUMsQ0FBQztRQUMzRSxDQUFDLENBQUMsQ0FBQTtJQUNOLENBQUMsQ0FBQyxDQUFBO0lBQ0YsUUFBUSxDQUFDLGlCQUFpQixFQUFDO1FBQ3ZCLEVBQUUsQ0FBQyxrQ0FBa0MsRUFBQztZQUNsQyxTQUFTLENBQUMsS0FBSyxDQUFDLHlEQUF5RCxDQUFDLENBQUM7UUFDL0UsQ0F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UFDLE9BQU8sQ0FBQywyREFBMkQsQ0FBQyxDQUFBO1FBQ2xGLENBQUMsQ0FBQyxDQUFBO0lBQ04sQ0FBQyxDQUFDLENBQUE7SUFDRixRQUFRLENBQUMsT0FBTyxFQUFDO1FBQ2IsRUFBRSxDQUFDLHNDQUFzQyxFQUFDO1lBQ3RDLFNBQVMsQ0FBQyxJQUFJLENBQUMsd0RBQXdELENBQUMsQ0FBQTtRQUM1RSxDQUFDLENBQUMsQ0FBQTtJQUNOLENBQUMsQ0FBQyxDQUFBO0FBQ04sQ0FBQyxDQUFDLENBQUEifQ==

View File

@ -1,104 +1,87 @@
import "typings-test";
import beautylog = require('../dist/index');
import 'typings-test'
import beautylog = require('../dist/index')
describe("beautylog",function(){
describe(".log(message)",function(){
it("should print a blue Dir message",function(){
beautylog.log('beautylog.log(), with normal logText, without logType');
describe('beautylog',function(){
describe('.log(message)',function(){
it('should print a blue Dir message',function(){
beautylog.log('beautylog.log(), with normal logText, without logType')
})
})
describe(".dir(message)",function(){
it("should print a blue Dir message",function(){
beautylog.dir('beautylog.dir(), with normal logText, without logType');
describe('.dir(message)',function(){
it('should print a blue Dir message',function(){
beautylog.dir('beautylog.dir(), with normal logText, without logType')
})
})
describe(".error(message)",function(){
it("should print a red error message",function(){
beautylog.error('beautylog.error(), with normal logText, without logType');
});
});
describe(".figlet",function(){
it("should print nice fonts to console in yellow",function(done){
beautylog.figlet("Async!",{font:"Star Wars",color:"yellow"}).then(done);
})
});
describe(".figletSync",function(){
it("should print nice fonts to console in yellow",function(){
beautylog.figletSync("Sync!",{font:"Star Wars",color:"blue"});
})
});
describe(".info(message)",function(){
it("should display a purple info message",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('.error(message)',function(){
it('should print a red error message',function(){
beautylog.error('beautylog.error(), with normal logText, without logType')
})
})
describe(".ok(message)",function(){
it("should display a green ok message",function(){
beautylog.ok('beautylog.ok(), with normal logText, without logType');
});
});
describe(".newLine(number)",function(){
it("create specified amount of new lines",function(){
beautylog.newLine(1);
});
});
describe(".ora(text,color)",function(){
it("should display, update, and end a message",function(done){
this.timeout(10000);
let testOra = new beautylog.Ora("This is a test text","green",true);
describe('.figlet',function(){
it('should print nice fonts to console in yellow',function(done){
beautylog.figlet('Async!',{font: 'Star Wars',color: 'yellow'}).then(done)
})
})
describe('.figletSync',function(){
it('should print nice fonts to console in yellow',function(){
beautylog.figletSync('Sync!',{font: 'Star Wars',color: 'blue'})
})
})
describe('.info(message)',function(){
it('should display a purple info message',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')
})
})
describe('.newLine(number)',function(){
it('create specified amount of new lines',function(){
beautylog.newLine(1)
})
})
describe('.ora(text,color)',function(){
it('should display, update, and end a message',function(done){
this.timeout(10000)
let testOra = new beautylog.Ora('This is a test text','green',true)
setTimeout(function(){
testOra.text("updated text!");
beautylog.info("another log message that uses the normal log function");
testOra.text('updated text!')
beautylog.info('another log message that uses the normal log function')
setTimeout(function(){
testOra.endOk("Allright, ora works!");
done();
},2000);
testOra.endOk('Allright, ora works!')
done()
},2000)
},2000)
});
it("should display an error message when ended with error",function(done){
this.timeout(10000);
let testOra = new beautylog.Ora("This is another test text","green");
setTimeout(function(){
testOra.endError("Allright, ora displays an error!");
done();
},2000)
});
});
describe(".success(message)",function(){
it("should display an orange warn message",function(){
beautylog.success('beautylog.success(), with normal logText, without logType');
})
});
describe(".warn",function(){
it("should display a orange warn message",function(){
beautylog.warn('beautylog.warn(), with normal logText, without logType');
});
});
describe(".Table",function(){
it("should print a nice table",function(){
(function(){
var testTable1 = new beautylog.Table("checks");
testTable1.push(['check1','success']);
testTable1.push(['check2','error']);
testTable1.push(['check3','error']);
testTable1.print();
var testTable2 = new beautylog.Table("custom",["Column1".red,"Column2".blue,"Column3".cyan]);
testTable2.push(["Hey","this","works"]);
testTable2.print();
})();
});
});
});
it('should display an error message when ended with error',function(done){
this.timeout(10000)
let testOra = new beautylog.Ora('This is another test text','green')
setTimeout(function(){
testOra.endError('Allright, ora displays an error!')
done()
},2000)
})
})
describe('.success(message)',function(){
it('should display an orange warn message',function(){
beautylog.success('beautylog.success(), with normal logText, without logType')
})
})
describe('.warn',function(){
it('should display a orange warn message',function(){
beautylog.warn('beautylog.warn(), with normal logText, without logType')
})
})
})

5
test/testbrowser.d.ts vendored Normal file
View File

@ -0,0 +1,5 @@
declare var plugins: {
gulp: any;
gulpBrowser: any;
easyserve: any;
};

View File

@ -15,4 +15,4 @@ plugins.gulp.task('default', ['compileBrowserJS'], function () {
plugins.easyserve("test/browser/");
});
plugins.gulp.start.apply(plugins.gulp, ['default']);
//# sourceMappingURL=testbrowser.js.map
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGVzdGJyb3dzZXIuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJ0ZXN0YnJvd3Nlci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSx5Q0FBeUM7QUFDekMsSUFBSSxPQUFPLEdBQUc7SUFDVixJQUFJLEVBQUUsT0FBTyxDQUFDLE1BQU0sQ0FBQztJQUNyQixXQUFXLEVBQUUsT0FBTyxDQUFDLGNBQWMsQ0FBQztJQUNwQyxTQUFTLEVBQUUsT0FBTyxDQUFDLFdBQVcsQ0FBQztDQUNsQyxDQUFDO0FBRUYsT0FBTyxDQUFDLElBQUksQ0FBQyxJQUFJLENBQUMsa0JBQWtCLEVBQUU7SUFDbEMsSUFBSSxNQUFNLEdBQUcsT0FBTyxDQUFDLElBQUksQ0FBQyxHQUFHLENBQUMsdUJBQXVCLENBQUM7U0FDakQsSUFBSSxDQUFDLE9BQU8sQ0FBQyxXQUFXLENBQUMsVUFBVSxFQUFFLENBQUM7U0FDdEMsSUFBSSxDQUFDLE9BQU8sQ0FBQyxJQUFJLENBQUMsSUFBSSxDQUFDLDRCQUE0QixDQUFDLENBQUMsQ0FBQztJQUMzRCxNQUFNLENBQUMsTUFBTSxDQUFDO0FBQ2xCLENBQUMsQ0FBQyxDQUFDO0FBRUgsT0FBTyxDQUFDLElBQUksQ0FBQyxJQUFJLENBQUMsU0FBUyxFQUFDLENBQUMsa0JBQWtCLENBQUMsRUFBRTtJQUM5QyxPQUFPLENBQUMsR0FBRyxDQUFDLGlDQUFpQyxDQUFDLENBQUM7SUFDL0MsT0FBTyxDQUFDLFNBQVMsQ0FBQyxlQUFlLENBQUMsQ0FBQztBQUN2QyxDQUFDLENBQUMsQ0FBQztBQUVILE9BQU8sQ0FBQyxJQUFJLENBQUMsS0FBSyxDQUFDLEtBQUssQ0FBQyxPQUFPLENBQUMsSUFBSSxFQUFFLENBQUMsU0FBUyxDQUFDLENBQUMsQ0FBQyJ9

View File

@ -1,51 +1,51 @@
import "typings-global";
import * as plugins from "./beautylog.plugins";
import {logNode} from "./beautylog.log.helpers";
import 'typings-global'
import * as plugins from './beautylog.plugins'
import {logNode} from './beautylog.log.helpers'
export let oraActive:boolean = false; // when an Ora is active (e.g. start()) this is true;
export let activeOra:Ora; //points to the currently active Ora object
export let oraActive: boolean = false // when an Ora is active (e.g. start()) this is true
export let activeOra: Ora // points to the currently active Ora object
export class Ora {
private _oraObject;
state:string;
constructor(textArg:string,colorArg:string,startArg:boolean = false){
state: string
private _oraObject
constructor(textArg: string,colorArg: string,startArg: boolean = false) {
this._oraObject = plugins.ora({
spinner:"dots",
text:textArg,
color:colorArg
});
startArg ? this._oraObject.start() : void(0);
spinner: 'dots',
text: textArg,
color: colorArg
})
startArg ? this._oraObject.start() : void(0)
}
text(textArg){
this._oraObject.text = textArg;
};
start(textArg?:string,colorArg?:string){
if(textArg) this._oraObject.text = textArg;
if(colorArg) this._oraObject.color = colorArg;
activeOra = this;
oraActive = true;
this._oraObject.start();
};
end(){
this._oraObject.stop();
this._oraObject.clear();
activeOra = undefined;
oraActive = false;
text(textArg) {
this._oraObject.text = textArg
}
endOk(textArg){
this.end();
logNode("ok",textArg);
};
endError(textArg){
this.end();
logNode("error",textArg);
};
pause(){
this._oraObject.stop();
start(textArg?: string,colorArg?: string) {
if (textArg) { this._oraObject.text = textArg }
if (colorArg) { this._oraObject.color = colorArg }
activeOra = this
oraActive = true
this._oraObject.start()
}
stop(){ // alias for end
this.end();
};
}
end() {
this._oraObject.stop()
this._oraObject.clear()
activeOra = undefined
oraActive = false
}
endOk(textArg) {
this.end()
logNode('ok',textArg)
}
endError(textArg) {
this.end()
logNode('error',textArg)
}
pause() {
this._oraObject.stop()
}
stop() { // alias for end
this.end()
}
}

View File

@ -1,49 +0,0 @@
import "typings-global";
import * as plugins from "./beautylog.plugins";
let tableHelpers = {
makeRow: function(cellCounterArg:number = 2,colorArg:string = "cyan"){
let rowArray = [];
for (let i = 0; i < (cellCounterArg); i++) {
rowArray.push(String(i + 1).cyan);
}
return rowArray;
}
};
export class Table {
tableHead:string[];
rows;
type:string;
constructor(tableTypeArg:string,tableHeadArrayArg:string[] = tableHelpers.makeRow()) {
switch (tableTypeArg) {
case "checks":
this.tableHead = ['Check Item:'.cyan,'Status:'.cyan];
break;
case "custom":
this.tableHead = tableHeadArrayArg;
break;
default:
break;
}
this.rows = [];
this.type = tableTypeArg;
}
push(row:string[]){
this.rows.push(row);
}
print() {
let table = new plugins.cliTable({
head: this.tableHead
});
for (let 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());
}
}

View File

@ -1,41 +1,41 @@
import "typings-global";
import plugins = require("./beautylog.plugins");
import {activeOra,oraActive} from "./beautylog.classes.ora";
let nativeLog = console.log;
let nativeError = console.error;
import 'typings-global'
import plugins = require('./beautylog.plugins')
import {activeOra,oraActive} from './beautylog.classes.ora'
let nativeLog = console.log
let nativeError = console.error
/**
* routes the console to got through beautylog, so beautylog can take action before things are logged to console.
*/
let route = function(statusArg:boolean){
if(statusArg == true){
console.log = beautyConsole.log;
console.error = beautyConsole.error;
console.log = beautyConsole.log
console.error = beautyConsole.error
} else {
console.log = nativeLog;
console.log = nativeLog
}
};
}
export let beautyConsole = {
log: function(logArg:any){
if(oraActive){
activeOra.pause();
nativeLog.apply(nativeLog, arguments);
activeOra.start();
activeOra.pause()
nativeLog.apply(nativeLog, arguments)
activeOra.start()
} else {
nativeLog.apply(nativeLog, arguments);
nativeLog.apply(nativeLog, arguments)
}
},
error: function(){
if(oraActive){
activeOra.pause();
nativeLog.apply(nativeError, arguments);
activeOra.start();
activeOra.pause()
nativeLog.apply(nativeError, arguments)
activeOra.start()
} else {
nativeLog.apply(nativeError, arguments);
nativeLog.apply(nativeError, arguments)
}
}
}
route(true);
route(true)

View File

@ -1,39 +1,39 @@
import "typings-global";
import plugins = require("./beautylog.plugins");
var defaultOptions = {
font:"Star Wars",
color: "green",
cb: function(){}
};
import 'typings-global'
import plugins = require('./beautylog.plugins')
let defaultOptions = {
font: 'Star Wars',
color: 'green',
cb: function() {}
}
export var figlet = function(textArg:string,optionsArg?){
var done = plugins.q.defer();
var mergeOptions = plugins.lodash.cloneDeep(defaultOptions);
var options = plugins.lodash.assign(mergeOptions,optionsArg);
export let figlet = function(textArg:string,optionsArg?){
let done = plugins.q.defer()
let mergeOptions = plugins.lodash.cloneDeep(defaultOptions)
let options = plugins.lodash.assign(mergeOptions,optionsArg)
plugins.figlet(textArg,{
font: options.font,
horizontalLayout: 'default',
verticalLayout: 'default'
}, function(err, data) {
if (err) {
console.log('Something went wrong...');
console.dir(err);
return;
console.log('Something went wrong...')
console.dir(err)
return
}
console.log(data[options.color]);
options.cb();
done.resolve();
});
return done.promise;
};
console.log(data[options.color])
options.cb()
done.resolve()
})
return done.promise
}
export var figletSync = function(textArg:string,optionsArg?){
var mergeOptions = plugins.lodash.cloneDeep(defaultOptions);
var options = plugins.lodash.assign(mergeOptions,optionsArg);
export let figletSync = function(textArg: string,optionsArg?){
let mergeOptions = plugins.lodash.cloneDeep(defaultOptions)
let options = plugins.lodash.assign(mergeOptions,optionsArg)
console.log(plugins.figlet.textSync(textArg,{
font: options.font,
horizontalLayout: 'default',
verticalLayout: 'default'
})[options.color]);
return true;
};
})[options.color])
return true
}

View File

@ -1,6 +1,6 @@
import * as plugins from "./beautylog.plugins";
import { beautyConsole } from "./beautylog.console";
import {remoteLog} from "./beautylog.remote";
import * as plugins from './beautylog.plugins'
import { beautyConsole } from './beautylog.console'
import { remoteLog } from './beautylog.remote'
/**
*
@ -9,99 +9,108 @@ import {remoteLog} from "./beautylog.remote";
* @returns {boolean}
*/
export let internalLog = function (logType: string = 'normal', logText: string = 'empty log') {
switch (plugins.smartenv.getEnv().runtimeEnv){
case "node":
logNode(logType,logText);
remoteLog(logType,logText);
break;
case "browser":
logBrowser(logText, logType);
break;
switch (plugins.smartenv.getEnv().runtimeEnv) {
case 'node':
logNode(logType, logText)
remoteLog(logType, logText)
break
case 'browser':
logBrowser(logText, logType)
break
default:
console.log("something is strange about the platform in which you try to use beautylog");
break;
};
};
console.log('something is strange about the platform in which you try to use beautylog')
break
}
}
let xC = {
black: 232,
blue: 39,
cyan: 87,
green: 112,
red: 196,
white: 231,
}
let localBl = {
dirPrefix: plugins.clc.bgXterm(39).xterm(231).bold(' DIR ') + ' ',
errorPrefix: ' Error: '.bgRed.white.bold + ' ',
dirPrefix: plugins.clc.bgXterm(xC.blue).xterm(xC.white).bold(' DIR ') + ' ',
errorPrefix: plugins.clc.bgXterm(xC.red)(' ') + plugins.clc.bgXterm(xC.black).xterm(xC.red).bold(' Error: ') + ' ',
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 + ' '
};
logPrefix: plugins.clc.bgXterm(xC.cyan)(' ') + plugins.clc.bgXterm(xC.black).xterm(xC.cyan).bold(' Log: ') + ' ',
okPrefix: plugins.clc.bgXterm(xC.green)(' ') + plugins.clc.bgXterm(xC.black).xterm(xC.green).bold(' OK! ') + ' ',
successPrefix: plugins.clc.bgXterm(xC.green)(' ') + plugins.clc.bgXterm(xC.black).xterm(xC.green).bold(' Success: ') + ' ',
warnPrefix: plugins.clc.bgYellow(' ') + plugins.clc.bgBlack.yellow.bold(' Warn: ') + ' '
}
export let logNode = function (logType: string,logText: string) {
export let logNode = function (logType: string, logText: string) {
try {
switch (logType) {
case 'dir':
logText = localBl.dirPrefix + plugins.clc.xterm(26)(logText);
break;
logText = localBl.dirPrefix + plugins.clc.xterm(xC.blue)(logText)
break
case 'error':
logText = localBl.errorPrefix + logText.red.bold;
break;
logText = localBl.errorPrefix + plugins.clc.xterm(xC.red).bold(logText)
break
case 'info':
logText = localBl.infoPrefix + plugins.clc.xterm(198)(logText);
break;
logText = localBl.infoPrefix + plugins.clc.xterm(198)(logText)
break
case 'normal':
logText = localBl.normalPrefix + logText.cyan.bold;
break;
logText = localBl.logPrefix + plugins.clc.xterm(xC.cyan).bold(logText)
break
case 'ok':
logText = localBl.okPrefix + logText.bold;
break;
logText = localBl.okPrefix + plugins.clc.bold(logText)
break
case 'success':
logText = localBl.successPrefix + logText.green.bold;
break;
logText = localBl.successPrefix + plugins.clc.xterm(xC.green).bold(logText)
break
case 'warn':
logText = localBl.warnPrefix + logText.bold;
break;
logText = localBl.warnPrefix + plugins.clc.bold(logText)
break
case 'log':
logText = localBl.normalPrefix + logText.blue.bold;
break;
logText = localBl.logPrefix + plugins.clc.blue.bold(logText)
break
default:
logText.blue.bold;
console.log(('unknown logType for "' + logText + '"').red.bold);
break;
plugins.clc.blue.bold(logText)
console.log(('unknown logType for "' + logText + '"'))
break
}
beautyConsole.log(logText);
return true;
}
catch (error) {
console.log(localBl.errorPrefix + 'You seem to have tried logging something strange'.red.bold + error);
return false;
beautyConsole.log(logText)
return true
} catch (error) {
console.log(localBl.errorPrefix
+ 'You seem to have tried logging something strange' + error)
return false
}
}
let logBrowser = function (logText, logType) {
switch (logType) {
case 'dir':
logText = localBl.dirPrefix + plugins.clc.xterm(26)(logText);
break;
logText = localBl.dirPrefix + plugins.clc.xterm(26)(logText)
break
case 'error':
logText = localBl.errorPrefix + logText.red.bold;
break;
logText = localBl.errorPrefix + logText.red.bold
break
case 'info':
console.log('%c Info: %c ' + logText, 'background:#EC407A;color:#ffffff;', 'color:#EC407A;');
break;
console.log('%c Info: %c ' + logText, 'background:#EC407A;color:#ffffff;', 'color:#EC407A;')
break
case 'normal':
logText = localBl.normalPrefix + logText.cyan.bold;
break;
logText = localBl.logPrefix + logText.cyan.bold
break
case 'ok':
console.log('%c OK: %c ' + logText, "background:#000000;color:#8BC34A;", "color:#000000;");
break;
console.log('%c OK: %c ' + logText, 'background:#000000;color:#8BC34A;', 'color:#000000;')
break
case 'success':
console.log('%c Success: %c ' + logText, "background:#8BC34A;color:#ffffff;", "color:#8BC34A;");
break;
console.log('%c Success: %c ' + logText, 'background:#8BC34A;color:#ffffff;', 'color:#8BC34A;')
break
case 'warn':
console.log('%c Warn: %c ' + logText, "background:#000000;color:#FB8C00;", "color:#000000;");
break;
console.log('%c Warn: %c ' + logText, 'background:#000000;color:#FB8C00;', 'color:#000000;')
break
case 'log':
console.log('%c Log: %c ' + logText, "background:#42A5F5;color:#ffffff", "color:#42A5F5;");
break;
console.log('%c Log: %c ' + logText, 'background:#42A5F5;color:#ffffff', 'color:#42A5F5;')
break
default:
console.log('unknown logType for "' + logText + '"');
break;
console.log('unknown logType for "' + logText + '"')
break
}
};
};

View File

@ -1,6 +1,6 @@
import "typings-global";
import 'typings-global'
import {internalLog} from "./beautylog.log.helpers";
import {internalLog} from './beautylog.log.helpers'
/**
* logs an info to console
@ -9,12 +9,12 @@ import {internalLog} from "./beautylog.log.helpers";
*/
export let log = (logText) => {
return internalLog("log",logText)
return internalLog('log',logText)
}
export let info = (logText) => {
return internalLog('info',logText);
};
return internalLog('info',logText)
}
/**
* logs an 'OK!' message to console
@ -22,8 +22,8 @@ export let info = (logText) => {
* @returns {boolean}
*/
export let ok = (logText) => {
return internalLog("ok",logText);
};
return internalLog('ok',logText)
}
/**
* logs a success to console
@ -31,8 +31,8 @@ export let ok = (logText) => {
* @returns {boolean}
*/
export let success = (logText) => {
return internalLog("success",logText);
};
return internalLog('success',logText)
}
/**
* logs a 'warn:' message to console
@ -40,8 +40,8 @@ export let success = (logText) => {
* @returns {boolean}
*/
export let warn = (logText) => {
return internalLog("warn",logText);
};
return internalLog('warn',logText)
}
/**
* logs an error to console
@ -49,8 +49,8 @@ export let warn = (logText) => {
* @returns {boolean}
*/
export let error = (logText) => {
return internalLog("error",logText);
};
return internalLog('error',logText)
}
/**
* logs an directory to console
@ -58,31 +58,31 @@ export let error = (logText) => {
* @returns {boolean}
*/
export let dir = (logText) => {
return internalLog("dir",logText);
};
return internalLog('dir',logText)
}
/**
* 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");
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++;
export let logReduced = (logTextArg: string,repeatEveryTimesArg: number = 0) => {
if (logTextArg === previousMessage && (repeatEveryTimesArg === 0 || sameMessageCounter != repeatEveryTimesArg)) {
sameMessageCounter++
} else {
sameMessageCounter = 0;
previousMessage = logTextArg;
log(logTextArg);
sameMessageCounter = 0
previousMessage = logTextArg
log(logTextArg)
}
};
let previousMessage:string = "";
let sameMessageCounter:number = 0;
}
let previousMessage: string = ''
let sameMessageCounter: number = 0

View File

@ -1,11 +1,19 @@
import "typings-global";
import 'typings-global';
export import lodash = require("lodash");
export import smartenv = require("smartenv");
export import q = require("q")
export let cliTable = require("cli-table2");
export import colors = require("colors");
export let clc = require("cli-color");
export let figlet = require("figlet");
export import loggly = require("loggly");
export let ora = require("ora");
import * as lodash from 'lodash'
import * as smartenv from 'smartenv'
import * as q from 'q'
import * as clc from 'cli-color'
let figlet = require('figlet')
import * as loggly from 'loggly'
let ora = require('ora')
export {
lodash,
smartenv,
q,
clc,
figlet,
loggly,
ora
}

View File

@ -3,7 +3,6 @@ import "typings-global";
import * as plugins from "./beautylog.plugins";
// export classes
export {Table} from "./beautylog.classes.table";
export {Ora} from "./beautylog.classes.ora";
// export methods

3
tslint.json Normal file
View File

@ -0,0 +1,3 @@
{
"extends": "tslint-config-standard"
}