-
Notifications
You must be signed in to change notification settings - Fork 82
Make user-facing logs more consistent and testable #192
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
Comments
I replied to the above comments: That was nearly a month ago, and you've not seen any progress. There are two major reasons for this (aside from # of hours in a day):
These two factors reinforce each other to impede progress. Working quickly and easily toward a slightly nebulous goal would let me show a prototype for critique. Working slowly toward a defined goal might take a while, but at least I'd see where I has headed and likely end up close to your vision once the time was put in. I don't mind putting the time in. I've done so, trying a couple of approaches before discarding. I mentioned a minor reason above. I'll explain it so you have full background. And it does depend on my guess about your preferred direction. If that's off, my whole ball of feelings unravels! In my heart of hearts, I don't believe in the goal I guessed at above. (That doesn't mean I won't implement it if you do.) I believe in typed logging objects that help ensure consistency and that would reduce developer error (although if each object type is used in one location, I am not sure it helps that much), but I don't think it would aid testability, unless the tests were able to read the objects off a stream, effectively checking their type. But this approach makes me uneasy. It reminds me of tests I've seen that use constants defined in production code to evaluate an outcome. The test passes because observed output contains the constant. But a developer accidentally introduced a typo in the constant. The test continues to pass because there was a single (now flawed) source of truth, but the production code has an error. I fear that relying on types defined in production would have a similar risk. (One could argue that the current tests, which check the structure of a json object that's fed into the logger, might fall prey to this as well; the logger could decide not to emit some attributes or combine them in a weird way. But that's maybe a little paranoid, and the only way I think around it would be to write tests that drove git-absorb from the outside.) Man. That should've been a blog post. All that to say that I've found in the past that being clever trying to reduce duplication between production and test code doesn't always yield the benefits we've hoped it would, and that a change to the production code and a search-and-replace in test code has served me as well. But experiences differ; maybe it depends on the domain, environment, scope of the project, developers involved, etc. For a small project with a benevolent dictator, perhaps code-sharing is the way to go. It sounds like I'm trying to fight against a change. I'm not. It's your project, and I feel bad that the changes in #175 and #182 have introduced something in the tests that you don't love. I would like to work to improve the code. I just need a nudge. |
yeah, this is basically what i'm thinking. i want to know, at compile time, what logs are "important" and what their fields are. not having to parse json in tests is a bonus. fwiw, it's not like i'm going to reject all subsequent prs if you can't get this to work. give it the old college try |
In #175 and #182, I changed a bunch of log messages and altered tests to verify log message that exist to provide always-visible user feedback.
@tummychow, at the time you mentioned
and
The text was updated successfully, but these errors were encountered: