Closed alalamav closed 5 years ago
Since go-tun2socks is a client program and has a relatively small logging footprint, I am not worried about the performance.
It's good to has leveled logging support, I am happy to see a PR for this feature. By defining our own logging interface, it should be quite easy to switch from one logging lib to another, we can further allow registering an external logger, so feel free to choose a handy one if you are going to create a PR :)
@alalamav I made a simple logger just filter out logs according to loglevel, feel free to create a more sophisticated logger (custom prefixs, coloring) and replace the default one by including it as a module.
Awesome! I think this will suffice for now. Thanks for the quick implementation.
Unconditional logging can hurt performance and increase memory utilization. Given that golang's
log
package does not support logging levels (i.e. Error, Warning, Info, Debug), we should consider migrating to a configurable logging library.Mature and widely used implementations include:
@eycorsican, I'm happy to implement this change as soon as we decide on a library.