-
Notifications
You must be signed in to change notification settings - Fork 99
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 #39
Comments
Yeah, a verbose mode (-v / --verbose) with that kind of logs is a really good idea. Could you share with us how these logs would looks like? Thanks! |
IMHO, logging everything isn't the best approach. We might provide some useful data (imposter file, path, params or the satisfied regex) instead, in order to let the user know why or why not it has matched. What do you think? |
I think that an approach like the middleware of gin-gonic will be fine, I'm agree with Joan that logging everything could be a little messy, instead of that logging all http request and loading file is a better approach |
So, everything should stay as it is in case of logging? |
I miss the log functionality as well. I would like to be able to see the requests in the logs. For this, log levels could be specified for the respective path. This way the log level can be set in config. As an example, if LogLevel of the path is set to "Trace" but in the config the LogLevel is set to "Error" no log is written. This can reduce the amount of logs. This is even supported by the log frameworks. There is nothing to reinvent. |
We're already working and discussing it, but looks like we're going to introduce multiple levels of verbosity. However, the idea is to start by adding verbosity levels at program scope instead of imposter, as you suggested. You can find more information at #100 and #101. |
Sorry to reply to an old topic. I have a need for this or #100. Basically anything that makes it easier to get access to specific requests. Was this work dropped at this point or was it completed in a different way? |
hey @tateexon, I think there has been no news since then, but contributions are welcome! :) |
hey @joanlopez , i'd like to lend a hand on this, can i get this assigned to me? |
Hey, @tomp21! Yeah, sure! I assigned you! Thanks for engaging! 🙇🏻 Just to be clear, I'd expect you to come with a more or less formal proposal before starting to write some lines of code, as I think the challenge here is having a clear idea on what levels of verbosity the logger should have, and what amount of information to print on each. |
hey @joanlopez i just took a look at the codebase and gave it a thought, IMO having the full request logged could be useful in limited scenarios, I'd have that at debug level logs, and keep the useful data you proposed before at normal info level logging, which would be the default, having an error log level available for quieter runs. I'm not sure we can give much info on why something matched or not, but we definitely could have a catch all handler to log whatever hasn't matched, which could be useful to see the dropped ones, which I'd also include at info loglevel WDYT? |
Hey @tomp21,
I think having that as a separate feature, as @tateexon suggested is better because:
I'd suggest something like:
At time of introducing that, I'd also add support for filtering by log level.
To do it, I'd suggest to follow an incremental approach, instead of trying to code all at once. For instance, we could start by defining some basic structure, with the standard levels, a logger that can be filtered by level, and replacing the existing calls to What you think? How do you see it? Would you be happy to contribute with that? Thanks! 🙇🏻 |
Hey @tateexon, I'm sorry to read that you contributing experience hasn't been good, apologies. But let me state what I think have happened:
That said, if you are still interested in contributing, I'd be happy to follow on reviewing your PRs, once you have some ready, with the feedback applied. For instance, if @tomp21 is going to focus on improvement the logging, we could try to extract the changes for dumping requests from your PR and get that in shape, ready to get merged. As I said to @tomp21, I think that would be a nice feature to add to Killgrave, and that some users would be appreciate. Up to you! And anyway, thanks for your efforts and interest so far! 🙇🏻 |
@joanlopez The company I was working for that needed my changes used my fork until they implemented their own mock server solution. So all of my PRs at this point can be closed. I didn't have a bad experience, you were doing the right thing and keeping the code base clean and I needed additional functionality fast to meet deadlines. I didn't have time to break up to smaller change sets as requested because I was already onto my next task. In short I was a crappy contributor and my PR ended up in limbo for good reasons. |
I think this project can hugely benefit from structured logging.
User should be able to see what request server handled and how (maybe why they haven't handled by supposed handler, what errors of validation happened. It can be difficult to inspect this manually).
So structured logging can help to deal with possibly huge logs that current project can generate.
We can use some dependency for this functionality such as:
https://github.com/sirupsen/logrus (very user friendly, also can be used instead of standard log)
https://github.com/uber-go/zap
The text was updated successfully, but these errors were encountered: