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

Add Zap Logger #1082

Merged
merged 4 commits into from
Oct 6, 2021
Merged

Add Zap Logger #1082

merged 4 commits into from
Oct 6, 2021

Conversation

boekkooi-lengoo
Copy link
Contributor

Hey,

To help with #1075 I have added zap as a logger to YoPass.
This adds the --log-level argument with the default being info to the server binary.

I hope this is ok.
Cheers,
Warnar

Ran `go get -u go.uber.org/zap`.
For more info see https://github.com/uber-go/zap
In order to allow for better logs with log levels.
https://github.com/uber-go/zap was added as a logger using `go get -u go.uber.org/zap`.
This adds a logger, and it's usage to the YoPass server.
This should help with issue jhaals#1075
@codecov
Copy link

codecov bot commented Oct 2, 2021

Codecov Report

Merging #1082 (1354745) into master (84992f4) will decrease coverage by 1.83%.
The diff coverage is 44.44%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1082      +/-   ##
==========================================
- Coverage   80.00%   78.16%   -1.84%     
==========================================
  Files           6        6              
  Lines         390      403      +13     
==========================================
+ Hits          312      315       +3     
- Misses         52       58       +6     
- Partials       26       30       +4     
Impacted Files Coverage Δ
pkg/server/server.go 86.17% <44.44%> (-7.46%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 62684cf...1354745. Read the comment docs.

Copy link
Owner

@jhaals jhaals left a comment

Choose a reason for hiding this comment

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

Great addition! 👍 The one thing left fixing is the HTTP logging which is currently not zap.

::1 - - [06/Oct/2021:09:19:04 +0200] "GET /secret/50b5f7ff-bb2a-423b-9079-bea38652f50d HTTP/1.1" 404 32
{"level":"debug","ts":1633504746.398633,"caller":"server/server.go:104","msg":"Secret not found","error":"memcache: cache miss","key":"50b5f7ff-bb2a-423b-9079-bea38652f50d"}
::1 - - [06/Oct/2021:09:19:06 +0200] "GET /secret/50b5f7ff-bb2a-423b-9079-bea38652f50d HTTP/1.1" 404 32
::1 - - [06/Oct/2021:09:20:21 +0200] "GET / HTTP/1.1" 404 19

But I'd say lets follow that up in a separate PR.

@jhaals jhaals merged commit e3ada4e into jhaals:master Oct 6, 2021
@boekkooi-lengoo boekkooi-lengoo deleted the logging branch October 6, 2021 07:46
@boekkooi-lengoo
Copy link
Contributor Author

👍 Thank you. I totally missed the HTTP logger. Let me see what I can do about that one.

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.

2 participants