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

Add ability to set custom logger #48

Merged
merged 1 commit into from
Nov 19, 2021

Conversation

samherrmann
Copy link
Contributor

@samherrmann samherrmann commented Jun 18, 2021

Before this commit, a custom logger could be set with the LogMessages function. However, by using LogMessages not only is a custom logger set but also all received and sent messages are logged. Use cases exist where a custom logger is desired to log errors but not all messages.

@samherrmann
Copy link
Contributor Author

samherrmann commented Jun 18, 2021

If this pull request is accepted, maybe a change to the LogMessages function should be considered so that logging all messages no longer requires a custom logger to be set (single responsibility)?

From:

func LogMessages(logger Logger) ConnOpt

To:

func LogMessages() ConnOpt

https://github.com/sourcegraph/jsonrpc2/blob/v0.1.0/conn_opt.go#L32

This would be a breaking change however.

conn_opt_test.go Outdated Show resolved Hide resolved
@samherrmann samherrmann force-pushed the set-logger branch 3 times, most recently from 653ed49 to b3b263a Compare June 19, 2021 19:00
Before this commit, a custom logger could be set with the LogMessages
function. However, by using LogMessages not only is a custom logger set
but also all received and sent messages are logged. Use cases exist
where a custom logger is desired to log errors but not all messages.
Copy link
Member

@keegancsmith keegancsmith left a comment

Choose a reason for hiding this comment

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

sorry about the slow review! LGTM!!

@keegancsmith keegancsmith merged commit c9c77b6 into sourcegraph:master Nov 19, 2021
@samherrmann samherrmann deleted the set-logger branch November 19, 2021 13:12
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.

2 participants