Skip to content

Commit

Permalink
Expose bunyanStdSerializers on Logger instances
Browse files Browse the repository at this point in the history
  • Loading branch information
Mike Nason committed Nov 7, 2017
1 parent 292bce2 commit 6cbf258
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
5 changes: 4 additions & 1 deletion src/client.js
@@ -1,4 +1,4 @@
import bunyan from 'bunyan';
import bunyan, { stdSerializers } from 'bunyan';

// Safe console access for oldIE
import console from 'console';
Expand Down Expand Up @@ -96,3 +96,6 @@ ClientLogger.prototype.child = function () {
BUNYAN_LOGGER_LEVELS.forEach((level) => {
ClientLogger.prototype[level] = logForLevel(level);
});

// Expose bunyan stdSerializers
ClientLogger.bunyanStdSerializers = stdSerializers;
5 changes: 3 additions & 2 deletions src/node.js
@@ -1,4 +1,4 @@
import bunyan from 'bunyan';
import bunyan, { stdSerializers } from 'bunyan';
import Rollbar from 'rollbar';
import bunyanFormat from 'bunyan-format';

Expand Down Expand Up @@ -93,4 +93,5 @@ BUNYAN_LOGGER_LEVELS.forEach((level) => {
NodeLogger.prototype[level] = logForLevel(level);
});


// Expose bunyan stdSerializers
NodeLogger.bunyanStdSerializers = stdSerializers;
6 changes: 5 additions & 1 deletion test/specs/logger.spec.js
@@ -1,4 +1,4 @@
import bunyan from 'bunyan';
import bunyan, { stdSerializers } from 'bunyan';
import TestLogger from '../testLogger';

// Require the package. For client tests, webpack should
Expand All @@ -15,6 +15,10 @@ describe('we-js-logger', () => {
expect(new Logger()).to.be.ok;
});

it('exposes "bunyanStdSerializers"', () => {
expect(Logger.bunyanStdSerializers).to.eql(stdSerializers);
});

describe('options', () => {
it('accepts a name', () => {
const name = 'WeTest!';
Expand Down

0 comments on commit 6cbf258

Please sign in to comment.