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

feat(logger): add service name as context #1287

Merged
merged 13 commits into from
May 28, 2024
Merged

feat(logger): add service name as context #1287

merged 13 commits into from
May 28, 2024

Conversation

dragosp1011
Copy link
Contributor

Context

  • fixes #

Changes

@github-actions github-actions bot added package: wallet/backend Wallet backend implementations type: source Source changes package: boutique/backend Boutique backend implementations labels Apr 10, 2024
Copy link
Member

@raducristianpopa raducristianpopa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of creating the logger in every class, we can inject it directly with Awilix:

container.register({
    logger: asValue(logger),
    sessionService: asClass(SessionService)
      .singleton()
      .inject(() => ({
        logger: logger.child(SessionService.name)
      })),
 })

This solution works as well, but I think it fits better to have everything loaded by Awilix.

@github-actions github-actions bot added the type: test Improvements or additions to tests label Apr 15, 2024
Copy link
Member

@beniaminmunteanu beniaminmunteanu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

@dragosp1011 dragosp1011 merged commit f7685a0 into main May 28, 2024
15 checks passed
@dragosp1011 dragosp1011 deleted the logger-context branch May 28, 2024 13:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package: boutique/backend Boutique backend implementations package: wallet/backend Wallet backend implementations type: source Source changes type: test Improvements or additions to tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants