You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It frustrates me that the logger isn't available at compile time for Kojo workers. To be able to log something the logger from the Kojo Worker Service is passed along the dependency chain after the container is built.
I had an idea on how to resolve this situation without passing dependencies around.
We should have a LoggerWrapper/LogDelegator/LoggerPlaceholder implementing the PSR LoggerInterface. This logger will have a single dependency, which is the actual logger. There should be a service definition for PSR LoggerInterface, which provides the wrapper. The service is shared (singleton) and doesn't get the wrapped logger injected at build time. We'll implement the aware trait as well if the LoggerAwareTrait isn't explosive enough. The wrapper itself will be logger aware.
Any service logging things needs to be Logger aware and get the wrapper injected.
The only thing left is to inject the actual logger into the wrapper before running the worker. This can be done in the proxy or the Worker builder. To do it in the proxy the wrapper service has to be made public. To do in the builder it just needs a dependency to the Logger. IMHO the worker builder should do it.
The text was updated successfully, but these errors were encountered:
It frustrates me that the logger isn't available at compile time for Kojo workers. To be able to log something the logger from the Kojo Worker Service is passed along the dependency chain after the container is built.
I had an idea on how to resolve this situation without passing dependencies around.
We should have a LoggerWrapper/LogDelegator/LoggerPlaceholder implementing the PSR LoggerInterface. This logger will have a single dependency, which is the actual logger. There should be a service definition for PSR LoggerInterface, which provides the wrapper. The service is shared (singleton) and doesn't get the wrapped logger injected at build time. We'll implement the aware trait as well if the LoggerAwareTrait isn't explosive enough. The wrapper itself will be logger aware.
Any service logging things needs to be Logger aware and get the wrapper injected.
The only thing left is to inject the actual logger into the wrapper before running the worker. This can be done in the proxy or the Worker builder. To do it in the proxy the wrapper service has to be made public. To do in the builder it just needs a dependency to the Logger. IMHO the worker builder should do it.
The text was updated successfully, but these errors were encountered: