gate icon indicating copy to clipboard operation
gate copied to clipboard

Add option to enabling writing logs to a file

Open Maxi-Mega opened this issue 2 years ago • 3 comments

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

Maxi-Mega avatar Dec 27 '21 13:12 Maxi-Mega

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 😅

R167 avatar Jan 13 '22 22:01 R167

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

robinbraemer avatar Mar 08 '22 11:03 robinbraemer

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

robinbraemer avatar Mar 08 '22 11:03 robinbraemer