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

the way to bootstrap logger with dependency injection #42

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions text/2021-12-09-logging.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,17 @@ func doSomething() {

> As you could see, it is actually a closure with an extern/global state.

With application using dependency injection framework (like `fx`), depends on
the different patterns for bootstrapping the application, there are several ways
to bootstrap the initialization of logger:

- if only root logger is provided into dependency injection framework, using
Copy link
Member

Choose a reason for hiding this comment

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

How about adding some examples?

Copy link
Member

Choose a reason for hiding this comment

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

How about adding some examples?

another method that wraps the original constructor with the logic for setting
the logger name
- if various loggers are provided into dependency injection framework, using
another method that wraps the original constructor with "Named Values" feature
to inject the logger with a certain name.

### Logging in Chaos Mesh Dashboard and gin

Chaos Mesh Dashboard use [gin](https://github.com/gin-gonic/gin) as thew web
Expand Down