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

logging: remove global logger #4751

Open
1 of 3 tasks
fasmat opened this issue Jul 27, 2023 · 0 comments
Open
1 of 3 tasks

logging: remove global logger #4751

fasmat opened this issue Jul 27, 2023 · 0 comments

Comments

@fasmat
Copy link
Member

fasmat commented Jul 27, 2023

Description

After #4749 there are still some parts in go-spacemesh left that use the global logger instead of a service-specific one. This makes testing & configuration of those logs more difficult.

Affected code

Specifically the following packages still use the global logger in some places:

  • events
  • common/types
  • hare
  • events in grpcserver

Todo:

The logger in those packages is used in functions that are not part of a service and thereby do not yet have a logger thats injected into them. Consider removing them by one of the following:

  • adding the functions as methods to an existing or new service
  • returning an error and have the caller log the event
  • drop the log (in case it is already logged upstream)
@fasmat fasmat self-assigned this Jul 27, 2023
bors bot pushed a commit that referenced this issue Aug 1, 2023
## Motivation
 Using a global logger makes testing harder and logging configuration more complicated. This PR removes most uses of the global logger to address this.

## Changes
- Instead of the global logger services now use their own logging instance, this should reduce the number of log lines produced by `0000.defaultLogger`
- There are still a few places where the global logger is used, primarily the `common/types` package where it cannot be replaced without some bigger changes. Issue for this: #4751

## Test Plan
n/a

## TODO
<!-- This section should be removed when all items are complete -->
- [x] Explain motivation or link existing issue(s)
- [x] Test changes and document test plan
- [x] Update documentation as needed

## DevOps Notes
<!-- Please uncheck these items as applicable to make DevOps aware of changes that may affect releases -->
- [x] This PR does not require configuration changes (e.g., environment variables, GitHub secrets, VM resources)
- [x] This PR does not affect public APIs
- [x] This PR does not rely on a new version of external services (PoET, elasticsearch, etc.)
- [x] This PR does not make changes to log messages (which monitoring infrastructure may rely on)
@fasmat fasmat removed their assignment Aug 17, 2023
bors bot pushed a commit that referenced this issue Sep 8, 2023
## Motivation
Part of  #4751 
Closes #4783

## Changes
- use local logger in poet clients
- provide the logger to `retryablehttp` to gain visibility on performed requests, retries, responses etc.
- cleanup poet test harness

## Test Plan
Existing tests pass
bors bot pushed a commit that referenced this issue Sep 8, 2023
## Motivation
Part of  #4751 
Closes #4783

## Changes
- use local logger in poet clients
- provide the logger to `retryablehttp` to gain visibility on performed requests, retries, responses etc.
- cleanup poet test harness

## Test Plan
Existing tests pass
bors bot pushed a commit that referenced this issue Sep 8, 2023
## Motivation
Part of  #4751 
Closes #4783

## Changes
- use local logger in poet clients
- provide the logger to `retryablehttp` to gain visibility on performed requests, retries, responses etc.
- cleanup poet test harness

## Test Plan
Existing tests pass
bors bot pushed a commit that referenced this issue Sep 8, 2023
## Motivation
Part of  #4751 
Closes #4783

## Changes
- use local logger in poet clients
- provide the logger to `retryablehttp` to gain visibility on performed requests, retries, responses etc.
- cleanup poet test harness

## Test Plan
Existing tests pass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: 📋 Backlog
Development

No branches or pull requests

1 participant