minekube / gate

High-Performance, Low-Memory, Lightweight, Extensible Minecraft Reverse Proxy with Excellent Multi-Protocol Version Support - Velocity/Bungee Replacement - Ready for dev and large deploy!
https://gate.minekube.com
Apache License 2.0
622 stars 50 forks source link

Add option to enabling writing logs to a file #51

Open Maxi-Mega opened 2 years ago

Maxi-Mega commented 2 years ago

I have two suggestions regarding the logging of the Gate proxy:

Thanks for your reading

R167 commented 2 years ago

On a related note, the logging library github.com/go-logr/logr is now on v1 (no longer v0) which broke the build when I naively updated my transient dependencies 😅

robinbraemer commented 2 years ago

@R167 github.com/go-logr/logr dependency is now updated in the new release

robinbraemer commented 2 years ago

I have two suggestions regarding the logging of the Gate proxy:

  • It would be nice to have the possibility to choose what we want in the logs. For example, in production I don't think the path of the file and the line from which the logger was called is any useful information. Maybe the ability to choose the format of the date would be interesting too, for instance if we want to be able to process the logs with an other application... which leads us to the second point.
  • Save the logs to a file, like any regular Minecraft proxy or server. For now, the only way I found to do that is to redirect manually the program outputs to a file like so: ./gate > logs.txt 2>&1, but color codes are not supported and render like this: �[34m.

Thanks for your reading

Hello, you can always make use of https://github.com/minekube/gate/blob/ee91199b2b7e44f385c873601dcaf30a100ae7be/pkg/runtime/logr/log.go#L45

Or setup a Gate instance specifying your own Logger https://github.com/minekube/gate/blob/ee91199b2b7e44f385c873601dcaf30a100ae7be/pkg/gate/gate.go#L37