Closed Tjzabel closed 4 years ago
Discussed in 2020-02-15 developer meeting.
@10eMyrT and @kennedy are leading research on this issue. The deliverable is a comment on this GitHub issue that addresses the key areas explained in the Details section of the original comment. Once the research is shared on this issue, we can close it and refer back to it as needed when writing the rest of the handlers.
I found a great article in creating a custom logger with the standard log
package and *log.logger
type: https://www.ardanlabs.com/blog/2013/11/using-log-package-in-go.html
The article suggest creating a *log.logger
object for each log situation (info, debug, error, etc).
Subject I am unsure of how to handle logging through multiple goroutines/services.
config.go/LoadConfig
section, and reuse it in each client. We just have to document that is the way.The other option is use a third party logging framework which extends the standard log
gives us the same abilities from the article.
Here are a list of logging libraries ranked by popularity (github stars) and dev activity. https://go.libhunt.com/categories/504-logging
The most popular and most active are:
I am honestly leaning towards third-party because it does all the hard work illustrated from the article, and has a singleton mechanic.
Let me know what you guys think
@kennedy generally, I think it makes sense to have a logger instance within each of the Client
structs.
The most popular and most active are:
1. https://github.com/Sirupsen/logrus 2. https://github.com/kpango/glg
I am honestly leaning towards third-party because it does all the hard work illustrated from the article, and has a singleton mechanic.
If using a third-party logging framework, I suggest logrus. It looks like it has a more diverse community and more activity than glg. Plus, another popular Go project, Podman, uses it for its logs. I've used Podman for debugging and loved the way they do debug logging, but didn't realize it was logrus:
https://github.com/containers/libpod/blob/f2bcc9cc7dc8b1937f39db503db96651d84c3e3e/go.mod#L63
@jwflory I agree logrus
is nice, and it seems to have a much larger community.
However, for the sake of TeleIRC and our goal of relying on as few 3rd party libraries as possible, I would prefer to just use the standard log
library. I think the real question is: Does it have all the features we need?
What are all your thoughts?
Perfect, that’s what I was leaning towards as well.
On Feb 19, 2020, at 5:02 PM, Tim Zabel notifications@github.com wrote:
@jwflory I agree logrus is nice, and it seems to have a much larger community.
However, for the sake of TeleIRC and our goal of relying on as few 3rd party libraries as possible, I would prefer to just use the standard log library. I think the real question is: Does it have all the features we need?
What are all your thoughts?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.
@Tjzabel I haven't done a thorough analysis, but my last comment could have been shiny-object syndrome :slightly_smiling_face: I also prefer to keep things simple, especially knowing that our biggest contributor group will likely be undergrad students, so long as the project is managed by RITlug. So, I'm in favor of simplicity over complexity.
That said, I really haven't done my homework here. I'll try to do a deeper dive soon… I've been focused on other things.
Discussed in 2020-02-22 developer meeting.
In the call, we briefly discussed how we wanted to do logging. To keep things simple, and since our use case is simple, we will use the standard library in Go for logging. A new issue is coming soon to migrate our existing print statements over to the logging library.
Closing! :ocean:
Also thanks @kennedy for leading the research on this one! I still learned something from this discussion :slightly_smiling_face:
Summary
Implement a standard way to log system and chat messages in TeleIRC
Background
Instead of writing
fmt.Println
statements when we want to redirect output tostdout
, we should implement Go'slog
package. This will give us much more fine tuned functionality for logging, and will also allow the user to specify whether or not they wish to see more verbose output.Details
All logs will go to
stdout
since we expect to run TeleIRC in a container../teleirc -v
)Outcome
Log messages appear in
stdout