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

Give all the things a logger instance #880

Merged
merged 7 commits into from Jan 3, 2019
Merged

Give all the things a logger instance #880

merged 7 commits into from Jan 3, 2019

Conversation

lox
Copy link
Contributor

@lox lox commented Dec 21, 2018

With the rise of our new --spawn param, I'd really like to have a prefix in the log output for the specific agent that console output is coming from. This is really, really hard to do with the global logger.

This moves to an instance that gets passed into anything that needs a logger. It's a lot of code and opens up a lot of spots for nil pointer errors as we rarely use constructors and tend to use direct struct instantiations.

I'd love some feels on this approach. It's been hard work and I don't super like the result, but it's probably more correct?

@sj26
Copy link
Member

sj26 commented Dec 21, 2018

Oof, I can already see the nil pointer errors in the test results. But I agree it does seem more correct. Perhaps we need to feel this pain first to move to a better pattern? I do think this is a step in the right direction, nice work.

@lox
Copy link
Contributor Author

lox commented Jan 2, 2019

Yeah, I considered a lot of other options that would be more magical, but ultimately I think simply passing in the logger instance to places where it's needed is the most "go-like".

@lox lox merged commit cdc03b0 into master Jan 3, 2019
@lox lox deleted the log-refactor branch January 3, 2019 00:31
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

2 participants