Skip to content

Commit

Permalink
fix(logger): allow log methods to be used in isolation (#997)
Browse files Browse the repository at this point in the history
  • Loading branch information
bcoe authored Oct 1, 2020
1 parent 71a6742 commit 38371ca
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
6 changes: 6 additions & 0 deletions packages/gcf-utils/src/logging/gcf-logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@ export class GCFLogger {

constructor(customDestination?: Destination) {
this.initPinoLogger(customDestination);
this.trace = this.trace.bind(this);
this.debug = this.debug.bind(this);
this.info = this.info.bind(this);
this.warn = this.warn.bind(this);
this.metric = this.metric.bind(this);
this.error = this.error.bind(this);
}

/* eslint-disable @typescript-eslint/no-explicit-any */
Expand Down
7 changes: 7 additions & 0 deletions packages/gcf-utils/test/gcf-logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,13 @@ describe('GCFLogger', () => {
logLevels[level]
);
});

it(`allows ${level} log to be passed as argument`, done => {
setTimeout(logger[level], 1);
setTimeout(() => {
return done();
});
});
}
}

Expand Down

0 comments on commit 38371ca

Please sign in to comment.