Open ghost opened 6 years ago
Yes. Logging is ignored, and needs to be improved!
Using a logger interface, such as the one you suggested by goa, is a great idea. Not sure we need to do the driver approach, as multiple loggers could easily be implemented using a MultiLogger
solution similar to the io.MultiWriter.
The logger could then be passed to the resgate server as part of the Config, as well as to the NATS client when creating that one.
Of course, using custom loggers like this is only when you wrap resgate's server package in your own main package. Resgate's own package main will use standard output.
Apart from this, it needs to be decided what to log, and what levels. NATS server has trace and debug logging. I am thinking about something similar:
https://github.com/nats-io/gnatsd/blob/master/main.go#L37
Any suggestions there?
well the best way i can contribute here it to highlight issues i have encountered on distributed systems.
Logging. Want to have a central place for logs that all devices logs end up in.
Log filtering You want to filter the logs.
All the above is because on distributed system you cant debug them in prod or dev unless you can do the 2 top things.
i would just standup a open tracing stack. https://github.com/opentracing/opentracing-go https://godoc.org/github.com/opentracing/opentracing-go
With open tracing, i am searching for the ability to do search retrieval on the central server. no fount it yet
the other big one is open consensus.
This combines metrics with tracing ( and logs)
https://opencensus.io/roadmap/ https://godoc.org/go.opencensus.io/trace
https://github.com/go-kit/kit/blob/master/tracing/opencensus/endpoint.go
So far, all the logging stuff has been ignored.
The problem is that all the different golang log libraries don't share a common standard interface, so the solution would be to design a standard interface and then make an adapter for each one, similar to the way the SQL package has all the different database drivers, at the cost of not being able to use specific features to each logger package. That itself could be a big task. After a quick Google there seems to be an example which uses adapters approach here: https://goa.design/implement/logging/