Skip to content

Commit

Permalink
fix: provide default context
Browse files Browse the repository at this point in the history
  • Loading branch information
gajus committed Dec 24, 2020
1 parent 3266e31 commit 5630d13
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/factories/createLogger.js
Expand Up @@ -88,6 +88,8 @@ const getFirstParentDomainContext = () => {
return {};
};

const defaultContext = {};

const createLogger = (onMessage: MessageEventHandlerType, parentContext?: MessageContextType): LoggerType => {
// eslint-disable-next-line id-length, unicorn/prevent-abbreviations
const log = (a, b, c, d, e, f, g, h, i, k) => {
Expand All @@ -99,7 +101,7 @@ const createLogger = (onMessage: MessageEventHandlerType, parentContext?: Messag

if (typeof a === 'string') {
if (!domain || process.domain === null) {
context = parentContext;
context = parentContext || defaultContext;
} else {
context = {
...getFirstParentDomainContext(),
Expand Down

0 comments on commit 5630d13

Please sign in to comment.