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

grpclog: refactor existing logger interfaces for better interoparability #6044

Closed
easwars opened this issue Feb 22, 2023 · 1 comment
Closed
Labels
Area: Tooling Includes anything related to Go builds, modules etc and includes Releases & Github Workflows. P2 Type: Internal Cleanup Refactors, etc

Comments

@easwars
Copy link
Contributor

easwars commented Feb 22, 2023

PrefixLogger is a concrete type, which has a field logger of type grpclog.DepthLoggerV2. The former delegates all logging to the latter.

grpclog.DepthLoggerV2 does not have a Debug or V method.

type DepthLoggerV2 interface {
	// InfoDepth logs to INFO log at the specified depth. Arguments are handled in the manner of fmt.Println.
	InfoDepth(depth int, args ...interface{})
	// WarningDepth logs to WARNING log at the specified depth. Arguments are handled in the manner of fmt.Println.
	WarningDepth(depth int, args ...interface{})
	// ErrorDepth logs to ERROR log at the specified depth. Arguments are handled in the manner of fmt.Println.
	ErrorDepth(depth int, args ...interface{})
	// FatalDepth logs to FATAL log at the specified depth. Arguments are handled in the manner of fmt.Println.
	FatalDepth(depth int, args ...interface{})
}

The global Logger, which we have to end up using (to implement debug logging and verbosity checking) is of type grpclog.LoggerV2, and it has methods for the same. We need to refactor these interfaces a little to ensure the implementation of PrefixLogger can delegate all calls to its field logger instead of having to use the package global Logger.

@easwars
Copy link
Contributor Author

easwars commented Aug 30, 2024

Fixed by #7465.

@easwars easwars closed this as completed Aug 30, 2024
@purnesh42H purnesh42H added the Area: Tooling Includes anything related to Go builds, modules etc and includes Releases & Github Workflows. label Sep 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Tooling Includes anything related to Go builds, modules etc and includes Releases & Github Workflows. P2 Type: Internal Cleanup Refactors, etc
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants