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

Feat: Improve log level flag description #113

Merged

Conversation

dreamjz
Copy link
Contributor

@dreamjz dreamjz commented Nov 14, 2023

Solve issue #94

Modification Description

  • Add package pkg/log
  • Change the type of flag log-level to string

Test cases

$ resonate -h 
...
     --log-level string   log level, Options: debug, info, warn, error. (default "info")
...
# Debug
$ resnoate serve --log-level=debug
time=xxx level=INFO msg="starting http server" addr=0.0.0.0:8001
time=xxx level=INFO msg="starting grpc server" addr=0.0.0.0:50051
...
time=xxx level=DEBUG msg=scheduler:add coroutine="Coroutine(metadata=Metadata(tid=tick:1699989540758:notify, tags=map[name:notify-subscriptions]))"
time=xxx level=DEBUG msg=scheduler:add coroutine="Coroutine(metadata=Metadata(tid=tick:1699989540758:timeout, tags=map[name:timeout-promises]))"
...
# Info
$ resonate serve --log-level=info
time=xxx level=INFO msg="starting http server" addr=0.0.0.0:8001
time=xxx level=INFO msg="starting metrics server" addr=:9090
...

$ resonate serve
time=xxx level=INFO msg="starting http server" addr=0.0.0.0:8001
time=xxx level=INFO msg="starting metrics server" addr=:9090
...

# Warn and Error
$ resonate serve --log-level=warn

$ resonate serve --log-level=error

# Uppercase level
$ resonate serve --log-level=DEBUG
...
time=xxx level=DEBUG msg=scheduler:rmv coroutine="Coroutine(metadata=Metadata(tid=tick:1699990746456:notify, tags=map[aio:store name:notify-subscriptions]))"


# Unsupported level
$ resonate serve --log-level=not-support
xxx ERROR failed to parse log level error="unrecognized level: not-support"
Error: unrecognized level: "not-support"
Usage:
  resonate serve [flags]
...

Copy link
Contributor

@guergabo guergabo left a comment

Choose a reason for hiding this comment

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

amazing job! thanks so much for this contribution 🎉

Copy link

codecov bot commented Nov 14, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (2c924b7) 67.16% compared to head (37b9605) 67.16%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #113   +/-   ##
=======================================
  Coverage   67.16%   67.16%           
=======================================
  Files          57       57           
  Lines        5944     5944           
=======================================
  Hits         3992     3992           
  Misses       1667     1667           
  Partials      285      285           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@guergabo guergabo merged commit 23a7457 into resonatehq:main Nov 14, 2023
5 checks passed
@dfarr
Copy link
Member

dfarr commented Nov 14, 2023

Thank you so much @dreamjz 🎉🎉🎉

@dreamjz dreamjz deleted the feat-log_lvl_description-enhancement branch November 15, 2023 18:02
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.

3 participants