Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: Logger #4

Open
Firtzberg opened this issue Feb 25, 2021 · 1 comment
Open

Feature request: Logger #4

Firtzberg opened this issue Feb 25, 2021 · 1 comment
Assignees

Comments

@Firtzberg
Copy link
Contributor

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.

@Firtzberg
Copy link
Contributor Author

Consider extracting this DI logger placeholder into separate package. Placeholder doesn't have to be specific to kojo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants