From 57479963d986bb73c4cfa41507c78a14ee2f9dea Mon Sep 17 00:00:00 2001 From: Flynn Joffray Date: Fri, 27 Jan 2017 15:41:32 -0800 Subject: [PATCH] logger singleton style instantiation --- .README.md | 12 +++- README.md | 12 +++- docs/Logger.html | 2 +- docs/Message.html | 2 +- docs/WebSocketClient.html | 2 +- docs/WebSocketServer.html | 2 +- docs/global.html | 2 +- docs/index.html | 2 +- docs/index.js.html | 92 ++++++++++++++-------------- docs/lib_logger.js.html | 78 +++++++++++------------ docs/lib_message.js.html | 2 +- docs/lib_websocket_client.js.html | 2 +- docs/lib_websocket_server.js.html | 2 +- docs/module-oak-tools.html | 2 +- examples/websocket.server.example.js | 7 ++- index.js | 2 +- package.json | 2 +- test/logger.test.js | 3 +- test/websocket.server.test.js | 4 +- 19 files changed, 125 insertions(+), 107 deletions(-) diff --git a/.README.md b/.README.md index ecc1888..4e55669 100644 --- a/.README.md +++ b/.README.md @@ -26,12 +26,20 @@ Head on over to the [documentation](https://oaklabsinc.github.io/oak-tools/) pag The logger is based off [pino](https://github.com/pinojs/pino) and has nearly the same same option parameters. The following example are the default options. ```javascript -const Logger = require('oak-tools').logger -let log = new Logger({ +const { logger } = require('oak-tools') +let log = logger({ level: 'info', stream: process.stdout, pretty: true }) +log.info('sup') +log.error({ + err: new Error('crap...') +}) +log.debug({ + msg: 'debug message here', + now: Date.now() +}) ``` diff --git a/README.md b/README.md index 287425e..3cb40f0 100644 --- a/README.md +++ b/README.md @@ -26,12 +26,20 @@ Head on over to the [documentation](https://oaklabsinc.github.io/oak-tools/) pag The logger is based off [pino](https://github.com/pinojs/pino) and has nearly the same same option parameters. The following example are the default options. ```javascript -const Logger = require('oak-tools').logger -let log = new Logger({ +const { logger } = require('oak-tools') +let log = logger({ level: 'info', stream: process.stdout, pretty: true }) +log.info('sup') +log.error({ + err: new Error('crap...') +}) +log.debug({ + msg: 'debug message here', + now: Date.now() +}) ``` diff --git a/docs/Logger.html b/docs/Logger.html index a056ad4..6442d7e 100644 --- a/docs/Logger.html +++ b/docs/Logger.html @@ -415,7 +415,7 @@
Returns:

diff --git a/docs/Message.html b/docs/Message.html index dbe9f5b..468de17 100644 --- a/docs/Message.html +++ b/docs/Message.html @@ -1309,7 +1309,7 @@
Returns:

diff --git a/docs/WebSocketClient.html b/docs/WebSocketClient.html index 3064220..c46c2c0 100644 --- a/docs/WebSocketClient.html +++ b/docs/WebSocketClient.html @@ -2195,7 +2195,7 @@

ready


diff --git a/docs/WebSocketServer.html b/docs/WebSocketServer.html index 915d9f0..91d9c4c 100644 --- a/docs/WebSocketServer.html +++ b/docs/WebSocketServer.html @@ -1308,7 +1308,7 @@
Type:

diff --git a/docs/global.html b/docs/global.html index cfae667..bfb29ff 100644 --- a/docs/global.html +++ b/docs/global.html @@ -512,7 +512,7 @@
Type:

diff --git a/docs/index.html b/docs/index.html index f6aeba6..7e5c682 100644 --- a/docs/index.html +++ b/docs/index.html @@ -55,7 +55,7 @@

Home

Classes