Skip to content

Commit 6cbf258

Browse files
author
Mike Nason
committed
Expose bunyanStdSerializers on Logger instances
1 parent 292bce2 commit 6cbf258

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

src/client.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import bunyan from 'bunyan';
1+
import bunyan, { stdSerializers } from 'bunyan';
22

33
// Safe console access for oldIE
44
import console from 'console';
@@ -96,3 +96,6 @@ ClientLogger.prototype.child = function () {
9696
BUNYAN_LOGGER_LEVELS.forEach((level) => {
9797
ClientLogger.prototype[level] = logForLevel(level);
9898
});
99+
100+
// Expose bunyan stdSerializers
101+
ClientLogger.bunyanStdSerializers = stdSerializers;

src/node.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import bunyan from 'bunyan';
1+
import bunyan, { stdSerializers } from 'bunyan';
22
import Rollbar from 'rollbar';
33
import bunyanFormat from 'bunyan-format';
44

@@ -93,4 +93,5 @@ BUNYAN_LOGGER_LEVELS.forEach((level) => {
9393
NodeLogger.prototype[level] = logForLevel(level);
9494
});
9595

96-
96+
// Expose bunyan stdSerializers
97+
NodeLogger.bunyanStdSerializers = stdSerializers;

test/specs/logger.spec.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import bunyan from 'bunyan';
1+
import bunyan, { stdSerializers } from 'bunyan';
22
import TestLogger from '../testLogger';
33

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

18+
it('exposes "bunyanStdSerializers"', () => {
19+
expect(Logger.bunyanStdSerializers).to.eql(stdSerializers);
20+
});
21+
1822
describe('options', () => {
1923
it('accepts a name', () => {
2024
const name = 'WeTest!';

0 commit comments

Comments
 (0)