-
Notifications
You must be signed in to change notification settings - Fork 0
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
Improve logging #5
Improve logging #5
Conversation
if err != nil { | ||
l.Fatal("Connection failed", zap.Error(err)) | ||
logger.Fatal("Connection failed.", zap.Error(err)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using logger.Fatal(...)
uses zap.Field appropriately like this
FATAL ferretdb/main.go:375 Connection failed. {"error": "some error"}
Sugared l.Fatal(...)
is expected for Fatalf usage, so error displayed string concatenated and isn't friendly.
FATAL ferretdb/main.go:375 Connection failed.{error 26 0 some error}
redactedURL := u.Redacted() | ||
l.Debugf("Pinging %s...", redactedURL) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need fro that on debug level
} | ||
|
||
if cli.Listen.Unix != "" { | ||
l.Debugf("--listen-unix flag is set. Ping to %s will be performed.", cli.Listen.Unix) | ||
|
||
urls = append(urls, "mongodb://"+url.PathEscape(cli.Listen.Unix)) | ||
urls = append(urls, &url.URL{Scheme: "mongodb", Path: url.PathEscape(cli.Listen.Unix)}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've actually tried to implement it like that before, but unfortunately url.URL
is not meant for unix socket as it escapes %
from the url.PathEscape
. It doesn't escape '/' though, so it's not possible to not use PathEscape
function.
Description
Closes #<issue_number>.
Readiness checklist
task all
, and it passed.@FerretDB/core
), Milestone (Next
), Labels, Project and project's Sprint fields.