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

Structured logging #179

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open

Structured logging #179

wants to merge 6 commits into from

Conversation

tomp21
Copy link

@tomp21 tomp21 commented Oct 28, 2024

Closes #39

This is a first iteration, some testing is pending still but i wanted to raise the PR to have some early feedback, specially on the creation of loghelper.go and the func (i Imposter) LogFields() method, it just didn't feel right to me to repeat the fields everywhere and this way it looks more maintainable to me, but perhaps there's something i'm overseeing

* add log level option and logging for non-matching requests

* format

* replace all log imports for logrus

* structured logs for watcher.go

* add log fields helper and log for route_matchers

* add exits on fatal errors, log level flag/config, logging field methods for requests and imposters

* replace printf for leveled logs

* add logs for handlers

* logging on configurations

* add os.Exit(1) after fatal errors

* replace all calls to log.Fatal to log.Error+os.Exit

* write body for missing requests

* undo makefile changes
internal/loghelper.go Outdated Show resolved Hide resolved
cmd/killgrave/main.go Outdated Show resolved Hide resolved
internal/app/cmd/cmd.go Outdated Show resolved Hide resolved
internal/app/cmd/cmd.go Outdated Show resolved Hide resolved
@tomp21
Copy link
Author

tomp21 commented Oct 29, 2024

@joanlopez thanks for the review, i addressed the comments, would you mind giving it another round?

}
}

// not used?
Copy link
Author

@tomp21 tomp21 Oct 29, 2024

Choose a reason for hiding this comment

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

also, @joanlopez , is this method ever used? since we configure s.router.NotFoundHandler i would assume that already acts as a catch all

@tomp21
Copy link
Author

tomp21 commented Nov 11, 2024

@joanlopez just came back to this one to resolve a conflict, could you please take a look so future changes in main don't require this PR to be updated too?

@joanlopez
Copy link
Member

Hey @tomp21!

Sorry, we have prioritized #139 because it's critical. Killgrave's codebase is increasing, as well as the contributors base, and we have many cool features on the pull requests pipeline, that's risky to introduce without a decent amount of testing (see the example of #173, where we had to fix an issue introduced in a previous changeset).

The good news is that we're very very close to merging it. I'll ping you once ready, so you can pull latest changes, and I'll have a final look to your PR, and see if there's any additional feedback I'd like to leave. So, you don't experience any additional conflict, and we can get this merged asap.

Meanwhile, thanks for your patience! 🙌🏻

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.

Structured logging
2 participants