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

chore(logger): Drop logger generic #2460

Merged
merged 17 commits into from
Feb 3, 2025
Merged

chore(logger): Drop logger generic #2460

merged 17 commits into from
Feb 3, 2025

Conversation

abi87
Copy link
Collaborator

@abi87 abi87 commented Feb 1, 2025

Cleaned up the logger generics.
Apologies to @fridrik01 for stealing this

Copy link

codecov bot commented Feb 1, 2025

Codecov Report

Attention: Patch coverage is 0% with 112 lines in your changes missing coverage. Please review.

Project coverage is 32.36%. Comparing base (2309cc5) to head (25104bc).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
cmd/beacond/defaults.go 0.00% 16 Missing ⚠️
consensus/cometbft/service/options.go 0.00% 12 Missing ⚠️
consensus/cometbft/service/service.go 0.00% 10 Missing ⚠️
cli/builder/options.go 0.00% 8 Missing ⚠️
node-core/builder/baseapp_options.go 0.00% 8 Missing ⚠️
cli/builder/builder.go 0.00% 7 Missing ⚠️
cmd/beacond/main.go 0.00% 5 Missing ⚠️
consensus/cometbft/service/log/cmt_logger.go 0.00% 5 Missing ⚠️
consensus/cometbft/service/log/sdk_logger.go 0.00% 5 Missing ⚠️
node-core/builder/builder.go 0.00% 5 Missing ⚠️
... and 26 more
Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #2460   +/-   ##
=======================================
  Coverage   32.36%   32.36%           
=======================================
  Files         350      350           
  Lines       15594    15592    -2     
  Branches       20       20           
=======================================
  Hits         5047     5047           
+ Misses      10184    10182    -2     
  Partials      363      363           
Files with missing lines Coverage Δ
cli/commands/setup.go 0.00% <ø> (ø)
consensus/cometbft/service/abci.go 0.00% <ø> (ø)
consensus/cometbft/service/prepare_proposal.go 0.00% <ø> (ø)
consensus/cometbft/service/process_proposal.go 0.00% <ø> (ø)
cli/commands/server/rollback.go 0.00% <0.00%> (ø)
cli/commands/server/start.go 0.00% <0.00%> (ø)
cli/config/server.go 0.00% <0.00%> (ø)
consensus/cometbft/cli/commands.go 0.00% <0.00%> (ø)
consensus/cometbft/service/commit.go 0.00% <0.00%> (ø)
consensus/cometbft/service/finalize_block.go 0.00% <0.00%> (ø)
... and 30 more

)

type SDKLogger[LoggerT log.AdvancedLogger[LoggerT]] struct {
log.AdvancedLogger[LoggerT]
type SDKLogger struct {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Todo: check if we can drop this type and what interface it is implementing (to assert it)

cmtlog "github.com/cometbft/cometbft/libs/log"
)

type CometLogger[LoggerT log.AdvancedLogger[LoggerT]] struct {
log.AdvancedLogger[LoggerT]
type CometLogger struct {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Todo: check if we can drop this type and what interface it is implementing (to assert it)

Copy link
Contributor

Choose a reason for hiding this comment

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

yebb I don't think CometLogger and SDKLogger are doing much as is

@abi87 abi87 marked this pull request as ready for review February 1, 2025 05:39
@abi87 abi87 requested a review from a team as a code owner February 1, 2025 05:39
@fridrik01
Copy link
Contributor

fridrik01 commented Feb 1, 2025

@abi87 I already did this as part of https://github.com/berachain/beacon-kit-internal/pull/59, I didn't want to merge that in so soon before mainnet launch as I combined it with changing logger to use the standard slog logger

@abi87
Copy link
Collaborator Author

abi87 commented Feb 1, 2025

@abi87 I already did this as part of berachain/beacon-kit-internal#59, I didn't want to merge that in so soon before mainnet launch as I combined it with changing logger to use the standard slog logger

I recall that. I think that PR is doing too much. I am down merging in the log generics cleanup quickly, I would take more care in switching the log library we use. Would you consider splitting your PR like this? I can close this one

@abi87
Copy link
Collaborator Author

abi87 commented Feb 2, 2025

@abi87 I already did this as part of berachain/beacon-kit-internal#59, I didn't want to merge that in so soon before mainnet launch as I combined it with changing logger to use the standard slog logger

@fridrik01 here you are an interesting post about the use of interfaces in our logger!!

Base automatically changed from drop-node-api-context-generic to main February 2, 2025 15:02
@fridrik01
Copy link
Contributor

fridrik01 commented Feb 2, 2025

@abi87 I already did this as part of berachain/beacon-kit-internal#59, I didn't want to merge that in so soon before mainnet launch as I combined it with changing logger to use the standard slog logger

@fridrik01 here you are an interesting post about the use of interfaces in our logger!!

lol, this makes the code so less readable.

@fridrik01
Copy link
Contributor

@abi87 I already did this as part of berachain/beacon-kit-internal#59, I didn't want to merge that in so soon before mainnet launch as I combined it with changing logger to use the standard slog logger

I recall that. I think that PR is doing too much. I am down merging in the log generics cleanup quickly, I would take more care in switching the log library we use. Would you consider splitting your PR like this? I can close this one

Nah, I think since you already did this again in a separate PR we go with that. You are right, these should be separate PRs anyway. Btw, the change from phuslu to slog is still something that would be nice to do eventually, but not the right time before mainnet launch

Copy link
Contributor

@fridrik01 fridrik01 left a comment

Choose a reason for hiding this comment

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

lgtm

cmtlog "github.com/cometbft/cometbft/libs/log"
)

type CometLogger[LoggerT log.AdvancedLogger[LoggerT]] struct {
log.AdvancedLogger[LoggerT]
type CometLogger struct {
Copy link
Contributor

Choose a reason for hiding this comment

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

yebb I don't think CometLogger and SDKLogger are doing much as is

Copy link
Contributor

@rezbera rezbera left a comment

Choose a reason for hiding this comment

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

nice

@abi87 abi87 merged commit 2271084 into main Feb 3, 2025
19 checks passed
@abi87 abi87 deleted the drop-logger-generic branch February 3, 2025 02:56
shotes pushed a commit that referenced this pull request Feb 3, 2025
Signed-off-by: aBear <abear@berachain.com>
shotes pushed a commit that referenced this pull request Feb 3, 2025
Signed-off-by: aBear <abear@berachain.com>
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

Successfully merging this pull request may close these issues.

None yet

3 participants