-
Notifications
You must be signed in to change notification settings - Fork 13
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 logs in daemon #352
Conversation
6c3972b
to
1cabcd2
Compare
api/server.go
Outdated
s.instance = grpc.NewServer() | ||
s.instance = grpc.NewServer( | ||
grpc.StreamInterceptor(grpc_middleware.ChainStreamServer( | ||
grpc_logrus.StreamServerInterceptor(log.NewEntry(log.StandardLogger())), |
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 was thinking this would log all the data in the stream but I cannot see any log from that. I wonder what this is for ? Maybe the StreamClientInterceptor
is the one to use.
And should this log all events from the stream or just the connection to the stream ?
@@ -32,9 +31,6 @@ func (execution *Execution) Complete(output string, data map[string]interface{}) | |||
execution.Output = output | |||
execution.OutputData = data | |||
|
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 guess you removed the logs here because there is not reason to have them with the rpc middleware
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.
Yes
My logs doesn't look like your
Probably because I'm using the |
Everything is good, I just want to fix few things before merge:
Also I like the colored output that is only available with TTY so maybe we should support another flag that might be the default with "colored" or something like that that would put core in a TTY mode and have the colored outputs but this is definitely not required for this PR |
@antho1404 done, to merge. |
I'm ok with this, I'm just thinking should we add the colors on this PR or another one ? the fix is quite easy I really think that a nice readable log for human is important but having something in plain text or json is great like that it gives a good flexibility. Any feedbacks ? @mesg-foundation/core |
I'm ok to add some flag to have colors with logs. But forcing color is a bad idea. |
Sorry I wasn't clear enough in my proposition of the fix, I don't want to replace the text version with the colored one, the text version is really good and a must have, i was talking about another mode like described in my previous comment with "colored". We would have the 3 following modes:
I would prefer colored logs by default because it's more user friendly and I think developers who have the need to extract logs will be more comfortable playing with the terminal and using flags etc... and developer who are less comfortable they would prefer something more "human readable" but I would love to have other feedbacks on that |
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.
Please remove support for colored.
Also the mesg-core start
should accept flag to configuration the LogFormat
and LogLevel
of the Core.
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.
It is not possible to configure the logs when starting the core with the CLI
MESG_LOG_FORMAT=json ./dev-cli start
./dev-cli logs
That is why a flag for the start
command is needed. This flag will send the right env variable to the daemon inside docker
Ok for me except the PR for dependencies is merged so we have to update this branch and add these dependencies in the vendor
|
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.
Looks good!
@krhubert Please merge dev and add the new packages to vendor.
cmd/start.go
Outdated
@@ -18,7 +21,41 @@ var Start = &cobra.Command{ | |||
DisableAutoGenTag: true, | |||
} | |||
|
|||
// logFormatValue reprenets log format flag value. |
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.
Typo on "reprenets"
cmd/start.go
Outdated
func (v *logFormatValue) Type() string { return "string" } | ||
func (v *logFormatValue) String() string { return string(*v) } | ||
|
||
// logLevelValue reprenets log level flag value. |
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.
Typo on "reprenets"
@NicolasMahe done |
PR for discussion about dameon logs.
Issue 196
Below are logs in
text
andjson
formats.@mesg-foundation/core Waiting for your feedback.