Skip to content

Commit

Permalink
0.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Mike Nason committed Nov 9, 2016
1 parent 1e55e79 commit e869ac7
Show file tree
Hide file tree
Showing 3 changed files with 82 additions and 67 deletions.
132 changes: 66 additions & 66 deletions API.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# ClientLogger

[src/client.js:13-16](https://github.com/wework/we-js-logger/blob/58d581984caa03c468f4b5d05d7e2a61cc66374b/src/client.js#L13-L16 "Source code on GitHub")
[src/client.js:13-16](https://github.com/wework/we-js-logger/blob/1e55e7968e53587841b3875f8117d99cfcb040cc/src/client.js#L13-L16 "Source code on GitHub")

A logger than can be used in browsers

Expand All @@ -12,15 +12,66 @@ A logger than can be used in browsers

Returns **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** a preconfigured `bunyan` logger instance

# BUNYAN_CONFIG_FIELDS

[src/util/common/config.js:9-14](https://github.com/wework/we-js-logger/blob/1e55e7968e53587841b3875f8117d99cfcb040cc/src/util/common/config.js#L9-L14 "Source code on GitHub")

Config keys that should always be passed to
`bunyan.createLogger`

# DEFAULT_ROOT_FIELDS

[src/util/common/config.js:22-25](https://github.com/wework/we-js-logger/blob/1e55e7968e53587841b3875f8117d99cfcb040cc/src/util/common/config.js#L22-L25 "Source code on GitHub")

Whitelist of extra config keys that should be
passed to `bunyan.createLogger` to form
root logger fields.

# DEFAULT_CONFIG

[src/util/common/config.js:28-39](https://github.com/wework/we-js-logger/blob/1e55e7968e53587841b3875f8117d99cfcb040cc/src/util/common/config.js#L28-L39 "Source code on GitHub")

# assembleConfig

[src/util/common/config.js:52-59](https://github.com/wework/we-js-logger/blob/1e55e7968e53587841b3875f8117d99cfcb040cc/src/util/common/config.js#L52-L59 "Source code on GitHub")

Merges config with DEFAULT_CONFIG, and appends passed in streams
with pre-configured streams for the runtime.

This is used to configure this library, not bunyan as it has a lot of
extra information. See `toBunyanConfig` below.

**Parameters**

- `config` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)**
- `getStreamsForRuntime` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** returns appended config.streams

Returns **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** runtimeConfig

# toBunyanConfig

[src/util/common/config.js:70-72](https://github.com/wework/we-js-logger/blob/1e55e7968e53587841b3875f8117d99cfcb040cc/src/util/common/config.js#L70-L72 "Source code on GitHub")

Create a config objct for bunyan from a full `we-js-logger` config object.
Extra keys passed to `bunyan.createLogger` become root logger fields, pass
a custom `config.rootFields` to control this behavior

**Parameters**

- `config` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)**
- `config.rootFields` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)<[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)>** extra fields to pass to bunyan

Returns **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** config for bunyan.createLogger

# ClientConsoleLogger

[src/util/client/consoleLogger.js:6-6](https://github.com/wework/we-js-logger/blob/58d581984caa03c468f4b5d05d7e2a61cc66374b/src/util/client/consoleLogger.js#L6-L6 "Source code on GitHub")
[src/util/client/consoleLogger.js:6-6](https://github.com/wework/we-js-logger/blob/1e55e7968e53587841b3875f8117d99cfcb040cc/src/util/client/consoleLogger.js#L6-L6 "Source code on GitHub")

Pretty logging to `console` for client applications

## write

[src/util/client/consoleLogger.js:13-45](https://github.com/wework/we-js-logger/blob/58d581984caa03c468f4b5d05d7e2a61cc66374b/src/util/client/consoleLogger.js#L13-L45 "Source code on GitHub")
[src/util/client/consoleLogger.js:13-45](https://github.com/wework/we-js-logger/blob/1e55e7968e53587841b3875f8117d99cfcb040cc/src/util/client/consoleLogger.js#L13-L45 "Source code on GitHub")

Transport to `console`

Expand All @@ -32,7 +83,7 @@ Returns **[undefined](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Re

# ClientLogentriesLogger

[src/util/client/logentriesLogger.js:10-16](https://github.com/wework/we-js-logger/blob/58d581984caa03c468f4b5d05d7e2a61cc66374b/src/util/client/logentriesLogger.js#L10-L16 "Source code on GitHub")
[src/util/client/logentriesLogger.js:10-16](https://github.com/wework/we-js-logger/blob/1e55e7968e53587841b3875f8117d99cfcb040cc/src/util/client/logentriesLogger.js#L10-L16 "Source code on GitHub")

Custom bunyan stream that transports to Logentries from client applications

Expand All @@ -45,7 +96,7 @@ Custom bunyan stream that transports to Logentries from client applications

## write

[src/util/client/logentriesLogger.js:23-30](https://github.com/wework/we-js-logger/blob/58d581984caa03c468f4b5d05d7e2a61cc66374b/src/util/client/logentriesLogger.js#L23-L30 "Source code on GitHub")
[src/util/client/logentriesLogger.js:23-30](https://github.com/wework/we-js-logger/blob/1e55e7968e53587841b3875f8117d99cfcb040cc/src/util/client/logentriesLogger.js#L23-L30 "Source code on GitHub")

Transport logs to Logentries

Expand All @@ -57,7 +108,7 @@ Returns **[undefined](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Re

# ClientRollbarLogger

[src/util/client/rollbarLogger.js:19-35](https://github.com/wework/we-js-logger/blob/58d581984caa03c468f4b5d05d7e2a61cc66374b/src/util/client/rollbarLogger.js#L19-L35 "Source code on GitHub")
[src/util/client/rollbarLogger.js:19-35](https://github.com/wework/we-js-logger/blob/1e55e7968e53587841b3875f8117d99cfcb040cc/src/util/client/rollbarLogger.js#L19-L35 "Source code on GitHub")

Custom rollbar stream that transports to logentries from a browser
Wortks with a global Rollbar instance that is already initialized.
Expand All @@ -77,7 +128,7 @@ integrating Rollbar in client apps

## write

[src/util/client/rollbarLogger.js:42-48](https://github.com/wework/we-js-logger/blob/58d581984caa03c468f4b5d05d7e2a61cc66374b/src/util/client/rollbarLogger.js#L42-L48 "Source code on GitHub")
[src/util/client/rollbarLogger.js:42-48](https://github.com/wework/we-js-logger/blob/1e55e7968e53587841b3875f8117d99cfcb040cc/src/util/client/rollbarLogger.js#L42-L48 "Source code on GitHub")

Transport logs to Rollbar

Expand All @@ -89,7 +140,7 @@ Returns **[undefined](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Re

# NodeLogger

[src/node.js:15-24](https://github.com/wework/we-js-logger/blob/58d581984caa03c468f4b5d05d7e2a61cc66374b/src/node.js#L15-L24 "Source code on GitHub")
[src/node.js:15-24](https://github.com/wework/we-js-logger/blob/1e55e7968e53587841b3875f8117d99cfcb040cc/src/node.js#L15-L24 "Source code on GitHub")

A logger than can be used in node processes

Expand All @@ -99,60 +150,9 @@ A logger than can be used in node processes

Returns **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** a preconfigured `bunyan` logger instance

# BUNYAN_CONFIG_FIELDS

[src/util/common/config.js:9-14](https://github.com/wework/we-js-logger/blob/58d581984caa03c468f4b5d05d7e2a61cc66374b/src/util/common/config.js#L9-L14 "Source code on GitHub")

Config keys that should always be passed to
`bunyan.createLogger`

# DEFAULT_ROOT_FIELDS

[src/util/common/config.js:22-25](https://github.com/wework/we-js-logger/blob/58d581984caa03c468f4b5d05d7e2a61cc66374b/src/util/common/config.js#L22-L25 "Source code on GitHub")

Whitelist of extra config keys that should be
passed to `bunyan.createLogger` to form
root logger fields.

# DEFAULT_CONFIG

[src/util/common/config.js:28-39](https://github.com/wework/we-js-logger/blob/58d581984caa03c468f4b5d05d7e2a61cc66374b/src/util/common/config.js#L28-L39 "Source code on GitHub")

# assembleConfig

[src/util/common/config.js:52-59](https://github.com/wework/we-js-logger/blob/58d581984caa03c468f4b5d05d7e2a61cc66374b/src/util/common/config.js#L52-L59 "Source code on GitHub")

Merges config with DEFAULT_CONFIG, and appends passed in streams
with pre-configured streams for the runtime.

This is used to configure this library, not bunyan as it has a lot of
extra information. See `toBunyanConfig` below.

**Parameters**

- `config` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)**
- `getStreamsForRuntime` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** returns appended config.streams

Returns **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** runtimeConfig

# toBunyanConfig

[src/util/common/config.js:70-72](https://github.com/wework/we-js-logger/blob/58d581984caa03c468f4b5d05d7e2a61cc66374b/src/util/common/config.js#L70-L72 "Source code on GitHub")

Create a config objct for bunyan from a full `we-js-logger` config object.
Extra keys passed to `bunyan.createLogger` become root logger fields, pass
a custom `config.rootFields` to control this behavior

**Parameters**

- `config` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)**
- `config.rootFields` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)<[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)>** extra fields to pass to bunyan

Returns **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** config for bunyan.createLogger

# ServerRollbarLogger

[src/util/server/rollbarLogger.js:10-17](https://github.com/wework/we-js-logger/blob/58d581984caa03c468f4b5d05d7e2a61cc66374b/src/util/server/rollbarLogger.js#L10-L17 "Source code on GitHub")
[src/util/server/rollbarLogger.js:10-17](https://github.com/wework/we-js-logger/blob/1e55e7968e53587841b3875f8117d99cfcb040cc/src/util/server/rollbarLogger.js#L10-L17 "Source code on GitHub")

Custom bunyan stream that transports to Rollbar from a node process.
See <https://rollbar.com/docs/notifier/node_rollbar/> for integration details
Expand All @@ -166,7 +166,7 @@ See <https://rollbar.com/docs/notifier/node_rollbar/> for integration details

## write

[src/util/server/rollbarLogger.js:27-37](https://github.com/wework/we-js-logger/blob/58d581984caa03c468f4b5d05d7e2a61cc66374b/src/util/server/rollbarLogger.js#L27-L37 "Source code on GitHub")
[src/util/server/rollbarLogger.js:27-37](https://github.com/wework/we-js-logger/blob/1e55e7968e53587841b3875f8117d99cfcb040cc/src/util/server/rollbarLogger.js#L27-L37 "Source code on GitHub")

handles `err` and `req` properties, attaches any custom data,
and calls the appropriate Rollbar method.
Expand All @@ -179,15 +179,15 @@ Returns **[undefined](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Re

# bunyanToRollbarLevelMap

[src/util/common/rollbar.js:9-16](https://github.com/wework/we-js-logger/blob/58d581984caa03c468f4b5d05d7e2a61cc66374b/src/util/common/rollbar.js#L9-L16 "Source code on GitHub")
[src/util/common/rollbar.js:9-16](https://github.com/wework/we-js-logger/blob/1e55e7968e53587841b3875f8117d99cfcb040cc/src/util/common/rollbar.js#L9-L16 "Source code on GitHub")

Map of bunyan log levels to Rollbar levels
<https://github.com/trentm/node-bunyan#levels>
<https://rollbar.com/docs/notifier/rollbar.js/api/#rollbardebuginfowarnwarningerrorcritical>

# bunyanLevelToRollbarLevelName

[src/util/common/rollbar.js:23-26](https://github.com/wework/we-js-logger/blob/58d581984caa03c468f4b5d05d7e2a61cc66374b/src/util/common/rollbar.js#L23-L26 "Source code on GitHub")
[src/util/common/rollbar.js:23-26](https://github.com/wework/we-js-logger/blob/1e55e7968e53587841b3875f8117d99cfcb040cc/src/util/common/rollbar.js#L23-L26 "Source code on GitHub")

Convert bunyan log level to rollbar level. Defaults to 'error'.

Expand All @@ -199,7 +199,7 @@ Returns **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refer

# ServerLogentriesLogger

[src/util/server/logentriesLogger.js:10-19](https://github.com/wework/we-js-logger/blob/58d581984caa03c468f4b5d05d7e2a61cc66374b/src/util/server/logentriesLogger.js#L10-L19 "Source code on GitHub")
[src/util/server/logentriesLogger.js:10-19](https://github.com/wework/we-js-logger/blob/1e55e7968e53587841b3875f8117d99cfcb040cc/src/util/server/logentriesLogger.js#L10-L19 "Source code on GitHub")

Custom bunyan stream that transports to logentries from a node process

Expand All @@ -216,7 +216,7 @@ Returns **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refer

# createRequestLogger

[src/util/server/requestLogger.js:12-48](https://github.com/wework/we-js-logger/blob/58d581984caa03c468f4b5d05d7e2a61cc66374b/src/util/server/requestLogger.js#L12-L48 "Source code on GitHub")
[src/util/server/requestLogger.js:12-48](https://github.com/wework/we-js-logger/blob/1e55e7968e53587841b3875f8117d99cfcb040cc/src/util/server/requestLogger.js#L12-L48 "Source code on GitHub")

Create a request loging express middleware

Expand All @@ -232,7 +232,7 @@ Returns **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Ref

# requestLoggerMiddleware

[src/util/server/requestLogger.js:24-47](https://github.com/wework/we-js-logger/blob/58d581984caa03c468f4b5d05d7e2a61cc66374b/src/util/server/requestLogger.js#L24-L47 "Source code on GitHub")
[src/util/server/requestLogger.js:24-47](https://github.com/wework/we-js-logger/blob/1e55e7968e53587841b3875f8117d99cfcb040cc/src/util/server/requestLogger.js#L24-L47 "Source code on GitHub")

Request Logger Middleware
Adds base logging to every request
Expand Down
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,21 @@ All notable changes to this project will be documented in this file. This projec
Generated by [auto-changelog](https://github.com/CookPete/auto-changelog)


#### [v0.3.0](https://github.com/wework/we-js-logger/compare/v0.2.1...v0.3.0)
> 9 November 2016
* Use fork of le_js to address oldIE issue [`#29`](https://github.com/wework/we-js-logger/pull/29)
* Update np to version 2.10.0 🚀 [`#27`](https://github.com/wework/we-js-logger/pull/27)
* Update babel-core to version 6.18.2 🚀 [`#25`](https://github.com/wework/we-js-logger/pull/25)
* Update eslint to version 3.9.1 🚀 [`#23`](https://github.com/wework/we-js-logger/pull/23)
* Update babel-loader to version 6.2.7 🚀 [`#21`](https://github.com/wework/we-js-logger/pull/21)
* Update webpack to version 1.13.3 🚀 [`#19`](https://github.com/wework/we-js-logger/pull/19)
* Use consolidated saucelabs account [`#16`](https://github.com/wework/we-js-logger/pull/16)
* Update test webpack config with recommended config from bunyan [`#15`](https://github.com/wework/we-js-logger/pull/15)
* Update all dependencies 🌴 [`#13`](https://github.com/wework/we-js-logger/pull/13)
* Witelist greenkeeper branches for travis [`#14`](https://github.com/wework/we-js-logger/pull/14)


#### [v0.2.1](https://github.com/wework/we-js-logger/compare/v0.2.0...v0.2.1)
> 23 October 2016
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "we-js-logger",
"version": "0.2.1",
"version": "0.3.0",
"description": "A logger for Node and Browser JS with Rollbar and Logentries transports",
"author": "WeWork Digital <dev-team@wework.com>",
"contributors": [
Expand Down

0 comments on commit e869ac7

Please # to comment.