update README
This commit is contained in:
parent
f72f5a0765
commit
b6c0b17ef8
@ -21,6 +21,9 @@ beautiful logging, TypeScript ready
|
||||
## Usage
|
||||
Use TypeScript for best in class instellisense.
|
||||
|
||||
**Quick Demo:**
|
||||
[![asciicast](https://asciinema.org/a/7w06e0n0ow2a1m2v1htbotru6.png)](https://asciinema.org/a/7w06e0n0ow2a1m2v1htbotru6)
|
||||
|
||||
```javascript
|
||||
beautylog.log('some log message') // normal console log message
|
||||
beautylog.info('some log message') // info console log message
|
||||
|
@ -1,15 +0,0 @@
|
||||
{
|
||||
"structure": {
|
||||
"readme": "index.md"
|
||||
},
|
||||
"plugins": [
|
||||
"tonic",
|
||||
"edit-link"
|
||||
],
|
||||
"pluginsConfig": {
|
||||
"edit-link": {
|
||||
"base": "https://gitlab.com/pushrocks/beautylog/edit/master/docs/",
|
||||
"label": "Edit on GitLab"
|
||||
}
|
||||
}
|
||||
}
|
101
docs/index.md
101
docs/index.md
@ -1,101 +0,0 @@
|
||||
# beautylog
|
||||
beautiful logging, TypeScript ready
|
||||
|
||||
## Availabililty
|
||||
[![npm](https://push.rocks/assets/repo-button-npm.svg)](https://www.npmjs.com/package/beautylog)
|
||||
[![git](https://push.rocks/assets/repo-button-git.svg)](https://gitlab.com/pushrocks/beautylog)
|
||||
[![git](https://push.rocks/assets/repo-button-mirror.svg)](https://github.com/pushrocks/beautylog)
|
||||
[![docs](https://push.rocks/assets/repo-button-docs.svg)](https://pushrocks.gitlab.io/beautylog/docs)
|
||||
[![docs](https://push.rocks/assets/repo-button-api.svg)](https://pushrocks.gitlab.io/beautylog/api)
|
||||
|
||||
## Status for master
|
||||
[![build status](https://gitlab.com/pushrocks/beautylog/badges/master/build.svg)](https://gitlab.com/pushrocks/beautylog/commits/master)
|
||||
[![coverage report](https://gitlab.com/pushrocks/beautylog/badges/master/coverage.svg)](https://gitlab.com/pushrocks/beautylog/commits/master)
|
||||
[![Dependency Status](https://david-dm.org/pushrocks/beautylog.svg)](https://david-dm.org/pushrocks/beautylog)
|
||||
[![bitHound Dependencies](https://www.bithound.io/github/pushrocks/beautylog/badges/dependencies.svg)](https://www.bithound.io/github/pushrocks/beautylog/master/dependencies/npm)
|
||||
[![bitHound Code](https://www.bithound.io/github/pushrocks/beautylog/badges/code.svg)](https://www.bithound.io/github/pushrocks/beautylog)
|
||||
[![TypeScript](https://img.shields.io/badge/TypeScript-2.x-blue.svg)](https://nodejs.org/dist/latest-v6.x/docs/api/)
|
||||
[![node](https://img.shields.io/badge/node->=%206.x.x-blue.svg)](https://nodejs.org/dist/latest-v6.x/docs/api/)
|
||||
|
||||
## Usage
|
||||
|
||||
```typescript
|
||||
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
|
||||
```
|
||||
The plugin produces beautiful output like this:
|
||||
![console.png](https://mediaserve.lossless.digital/github.com/pushrocks/beautylog/console.png)
|
||||
|
||||
### Ora Integration
|
||||
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();
|
||||
```
|
||||
|
||||
### 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.
|
||||
|
||||
Currently supported remote providers:
|
||||
|
||||
* loggly.com
|
||||
|
||||
```typescript
|
||||
beautylog.remote.loggly({
|
||||
token: "loggly-token",
|
||||
subdomain: "loggly-subdomain",
|
||||
appName: "some App Name",
|
||||
serverName: "some Server Name"
|
||||
});
|
||||
```
|
||||
|
||||
> Note: since beautylog monkeypatches all console log methods.
|
||||
There is no need to change anything in your code.
|
||||
Everything that is getting logged to your console by node will get logged to loggly as well.
|
||||
|
||||
For more information read the docs!
|
||||
|
||||
[![npm](https://push.rocks/assets/repo-header.svg)](https://push.rocks)
|
@ -42,9 +42,9 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"beautyremote": "^1.0.5",
|
||||
"npmts-g": "^6.0.0",
|
||||
"qenv": "^1.1.3",
|
||||
"smartchai": "^1.0.3",
|
||||
"typings-test": "^1.0.3"
|
||||
"smartdelay": "^1.0.1",
|
||||
"tapbundle": "^1.0.5"
|
||||
}
|
||||
}
|
||||
|
1
test/test.d.ts
vendored
1
test/test.d.ts
vendored
@ -1 +0,0 @@
|
||||
import 'typings-test';
|
105
test/test.js
105
test/test.js
@ -1,105 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
require("typings-test");
|
||||
const beautylog = require("../dist/index");
|
||||
const beautyremote = require("beautyremote");
|
||||
const qenv = require("qenv");
|
||||
let testQenv = new qenv.Qenv(process.cwd(), process.cwd() + '/.nogit');
|
||||
describe('beautylog', function () {
|
||||
describe('.registerRemote', function () {
|
||||
it('should accept a beautyremote', function () {
|
||||
let myRemote = new beautyremote.Loggly({
|
||||
token: process.env.LOGGLY_TOKEN
|
||||
});
|
||||
beautylog.registerRemote(myRemote);
|
||||
});
|
||||
});
|
||||
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('.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: 'orange' }).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() works!');
|
||||
});
|
||||
});
|
||||
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);
|
||||
beautylog.ora.start('This is a test text', 'green');
|
||||
setTimeout(function () {
|
||||
beautylog.ora.text('updated text!');
|
||||
beautylog.info('another log message that uses the normal log function');
|
||||
setTimeout(function () {
|
||||
beautylog.ora.endOk('Allright, ora works!');
|
||||
done();
|
||||
}, 2000);
|
||||
}, 2000);
|
||||
});
|
||||
it('should display an error message when ended with error', function (done) {
|
||||
this.timeout(10000);
|
||||
beautylog.ora.start('This is another test text', 'green');
|
||||
setTimeout(function () {
|
||||
beautylog.ora.endError('Allright, ora displays an error!');
|
||||
done();
|
||||
}, 2000);
|
||||
});
|
||||
});
|
||||
describe('.success(message)', function () {
|
||||
it('should display an orange warn message', function () {
|
||||
beautylog.success('beautylog.success() works!');
|
||||
});
|
||||
});
|
||||
describe('.warn', function () {
|
||||
it('should display a orange warn message', function () {
|
||||
beautylog.warn('beautylog.warn() works!');
|
||||
});
|
||||
});
|
||||
describe('.note', function () {
|
||||
it('should display a pink note', function () {
|
||||
beautylog.note('beautylog.note() works!');
|
||||
});
|
||||
});
|
||||
});
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGVzdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbInRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSx3QkFBcUI7QUFDckIsMkNBQTJDO0FBQzNDLDZDQUE0QztBQUU1Qyw2QkFBNEI7QUFDNUIsSUFBSSxRQUFRLEdBQUcsSUFBSSxJQUFJLENBQUMsSUFBSSxDQUFDLE9BQU8sQ0FBQyxHQUFHL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
||||
import 'typings-test'
|
||||
import { tap, expect } from 'tapbundle'
|
||||
|
||||
import beautylog = require('../dist/index')
|
||||
import * as beautyremote from 'beautyremote'
|
||||
|
||||
import * as qenv from 'qenv'
|
||||
let testQenv = new qenv.Qenv(process.cwd(), process.cwd() + '/.nogit')
|
||||
|
||||
describe('beautylog', function () {
|
||||
describe('.registerRemote', function () {
|
||||
it('should accept a beautyremote', function () {
|
||||
let myRemote = new beautyremote.Loggly({
|
||||
token: process.env.LOGGLY_TOKEN
|
||||
})
|
||||
beautylog.registerRemote(myRemote)
|
||||
})
|
||||
})
|
||||
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('.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: 'orange' }).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() works!')
|
||||
})
|
||||
})
|
||||
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)
|
||||
beautylog.ora.start('This is a test text', 'green')
|
||||
setTimeout(function () {
|
||||
beautylog.ora.text('updated text!')
|
||||
beautylog.info('another log message that uses the normal log function')
|
||||
setTimeout(function () {
|
||||
beautylog.ora.endOk('Allright, ora works!')
|
||||
done()
|
||||
}, 2000)
|
||||
}, 2000)
|
||||
})
|
||||
it('should display an error message when ended with error', function (done) {
|
||||
this.timeout(10000)
|
||||
beautylog.ora.start('This is another test text', 'green')
|
||||
setTimeout(function () {
|
||||
beautylog.ora.endError('Allright, ora displays an error!')
|
||||
done()
|
||||
}, 2000)
|
||||
})
|
||||
})
|
||||
describe('.success(message)', function () {
|
||||
it('should display an orange warn message', function () {
|
||||
beautylog.success('beautylog.success() works!')
|
||||
})
|
||||
})
|
||||
describe('.warn', function () {
|
||||
it('should display a orange warn message', function () {
|
||||
beautylog.warn('beautylog.warn() works!')
|
||||
})
|
||||
})
|
||||
describe('.note', function () {
|
||||
it('should display a pink note', function () {
|
||||
beautylog.note('beautylog.note() works!')
|
||||
})
|
||||
import * as smartdelay from 'smartdelay'
|
||||
|
||||
tap.test('.registerRemote should accept a beautyremote', async () => {
|
||||
let myRemote = new beautyremote.Loggly({
|
||||
token: process.env.LOGGLY_TOKEN
|
||||
})
|
||||
beautylog.registerRemote(myRemote)
|
||||
})
|
||||
|
||||
tap.test('.log(message) should print a blue Dir message', async () => {
|
||||
beautylog.log('beautylog.log(), with normal logText, without logType')
|
||||
})
|
||||
|
||||
tap.test('.dir(message) should print a blue Dir message', async () => {
|
||||
beautylog.dir('beautylog.dir(), with normal logText, without logType')
|
||||
})
|
||||
|
||||
tap.test('.error(message) should print a red error message', async () => {
|
||||
beautylog.error('beautylog.error(), with normal logText, without logType')
|
||||
})
|
||||
|
||||
tap.test('.figlet should print nice fonts to console in yellow', async () => {
|
||||
return beautylog.figlet('Async!', { font: 'Star Wars', color: 'orange' })
|
||||
})
|
||||
|
||||
tap.test('.figletSync should print nice fonts to console in yellow', async () => {
|
||||
beautylog.figletSync('Sync!', { font: 'Star Wars', color: 'blue' })
|
||||
})
|
||||
|
||||
tap.test('.info(message) should display a purple info message', async () => {
|
||||
beautylog.info('beautylog.dir(), with normal logText, without logType')
|
||||
})
|
||||
|
||||
tap.test('.logReduced(message) should only log two messages', async () => {
|
||||
beautylog.logReduced('Message 1')
|
||||
beautylog.logReduced('Message 1')
|
||||
beautylog.logReduced('Message 1')
|
||||
beautylog.logReduced('Message 1')
|
||||
beautylog.logReduced('Message 2')
|
||||
beautylog.logReduced('Message 2')
|
||||
})
|
||||
|
||||
tap.test('.ok(message) should display a green ok message', async () => {
|
||||
beautylog.ok('beautylog.ok() works!')
|
||||
})
|
||||
|
||||
tap.test('.newLine(number) create specified amount of new lines', async () => {
|
||||
beautylog.newLine(1)
|
||||
})
|
||||
|
||||
tap.test('.ora(text,color) should display, update, and end a message', async () => {
|
||||
beautylog.ora.start('This is a test text', 'green')
|
||||
await smartdelay.delayFor(2000)
|
||||
beautylog.ora.text('updated text!')
|
||||
await smartdelay.delayFor(2000)
|
||||
beautylog.info('another log message that uses the normal log function')
|
||||
await smartdelay.delayFor(2000)
|
||||
beautylog.ora.endOk('Allright, ora works!')
|
||||
})
|
||||
|
||||
tap.test('.ora(text,color) should display an error message when ended with error', async () => {
|
||||
beautylog.ora.start('This is another test text', 'green')
|
||||
await smartdelay.delayFor(2000)
|
||||
beautylog.ora.endError('Allright, ora displays an error!')
|
||||
})
|
||||
|
||||
tap.test('.success(message) should display an orange warn message', async () => {
|
||||
beautylog.success('beautylog.success() works!')
|
||||
})
|
||||
|
||||
tap.test('.warn should display a orange warn message', async () => {
|
||||
beautylog.warn('beautylog.warn() works!')
|
||||
})
|
||||
|
||||
tap.test('.note should display a pink note', async () => {
|
||||
beautylog.note('beautylog.note() works!')
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user