AvitalTamir / cyphernetes

A Kubernetes Query Language
https://cyphernet.es
Apache License 2.0
527 stars 11 forks source link

[ISSUE-111] Implement and patch log levels for `debug` and `error` #126

Closed jameskim0987 closed 1 month ago

jameskim0987 commented 1 month ago

Resolves #111

Changes made in this PR:

  1. In logDebug(), prepend "[DEBUG] "
  2. Implement logError() and prepend "[ERROR] "
  3. Convert the commented out fmt. statements into appropriate debug or error level logs
  4. Add test TestCyphernetesShellWithLogLevelFlag and TestCyphernetesShellWithLogLevelFlagHelper

Notes:

  1. log.Println() outputs to Stderr by default hence checking stderr for the added test
jameskim0987 commented 1 month ago

Hi @AvitalTamir , this PR is ready for review!

I'm noticing that the github action test is failing although all tests passes on my local. Do you know where the misalignment could be happening?

AvitalTamir commented 1 month ago

Hey @jameskim0987, after some investigation this has to do with how GitHub Actions handles stderr... For now I suggest we skip this test in CI, I tried working around it but didn't manage. If we can't find a way to make it work I think it's low impact enough and we can trust that it runs enough times successfully locally for us. I tried it here and it passes.

Let me know what you think.

jameskim0987 commented 1 month ago

Hi @AvitalTamir, I also looked into it a bit but didn't get much progress. I think we can settle on skipping the test in CI for now and keep track of this as a separate issue as an enhancement. Created an issue to keep track here: https://github.com/AvitalTamir/cyphernetes/issues/134

Otherwise, I think this PR is in good shape!

AvitalTamir commented 1 month ago

@jameskim0987 merged 💪