Closed lem-onade closed 9 months ago
I fixed this issue by calling setLoggerFactory(new ConsoleLoggerFactory()) in package B.
Is that a clean, permanent fix? If further discussion is necessary, lets plan a short one Wednesday before or after the meetings.
We're having the following problem:
package A makes use of handlersjs-logging. The logger factory is set properly,
getLoggerFor
works. No issues here. package A also uses package B, which contains some shared handlers. These handlers contain aprotected readonly logger = getLoggerFor(this, 5, 5)
Some handlers in package A extend the handlers from package B.
When trying to initiate one of the handlers in package A, the following error is thrown somewhere in package B:
The problem is not only with these handlers, but with any class that makes use of
getLoggerFor
that is part of a dependency of package A.It seems the
logger
andloggerFactory
variables in handlersjs-logging's main.ts do not share the same value as package A when handlersjs-logging is used in dependencies of this package.https://github.com/digita-ai/handlersjs/blob/1bd5e29b3b82378b3aef6bb3fd8034d46f7abf6c/packages/handlersjs-logging/lib/main.ts#L5-L6
Which causes the error on line 40 to be thrown for these dependencies.
https://github.com/digita-ai/handlersjs/blob/1bd5e29b3b82378b3aef6bb3fd8034d46f7abf6c/packages/handlersjs-logging/lib/main.ts#L38-L42
I'm wondering whether changing the
logger
andloggerFactory
variables to be global variables would fix this issue.Open to other ideas and suggestions.