Use the context logger, if available.#180
Open
nyergler wants to merge 3 commits intodatabricks:mainfrom
Open
Conversation
This allows use of a non-global logger for finer grained control.
internal/rows/rows.go
Outdated
| var _ dbsqlrows.Rows = (*rows)(nil) | ||
|
|
||
| func NewRows( | ||
| ctx context.Context, |
Contributor
There was a problem hiding this comment.
If the only thing we are using ctx for is to extract a logger. I would rather pass in a logger as the last argument to NewRows and ensure that dbsqllog.AddContext handles a nil first argument.
logger/logger.go
Outdated
|
|
||
| // Ctx returns a DBSQLLogger from the provided context. If no logger is found, | ||
| // the default logger is returned. | ||
| func Ctx(ctx context.Context) *DBSQLLogger { |
Contributor
There was a problem hiding this comment.
If find this function name a bit confusing. I know that naming things here is complicated by the use of the noun context and the type context but it would be good to have a function name that more clearly tells you what it is doing. Maybe something like FromCtx? I'm open to suggestions.
- Don't pass Context directly into NewRows - Rename function for retrieving logger from Context
Contributor
Author
|
Hi @rcypher-databricks , thanks for the review (and apologies for radio silence). I think I've addressed the feedback, let me know if you see anything else that could be improved. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This allows use of a non-global logger for finer grained control.