tus / tusd

Reference server implementation in Go of tus: the open protocol for resumable file uploads
https://tus.github.io/tusd
MIT License
3.09k stars 480 forks source link

cli: Add `show-startup-logs` flag to reduce startup log verbosity #1218

Closed apoorvapendse closed 2 days ago

apoorvapendse commented 1 week ago

This enables the user to enable or disable the startup logs while starting the tusd server. It helps the user suppress the startup logs as per their preference.

The flag has a default value of true. Fixes #1216.

Before: image


After:

set as false:

image

set as true explicity: image

default: image

Acconut commented 4 days ago

Thank you for opening this PR! While I agree that it's useful to control the startup logs, I am not sure if a dedicated flag is the best approach. In https://github.com/tus/tusd/issues/1216#issuecomment-2500945079, I propose the idea of adding a generic flag for controlling the log level. If the log level does allow info messages, the startup logs would not be printed. Feel free to join the discussion in the other issue and let us know what you think.

This would also help us to remove the additional if statements that are introduced in this PR. They are quite cumbersome and I worry that in the future we forget about them and add direct log statements that should actually go in such an if statement. Using slog's method for logging at specific levels removes the need for these conditional clauses.

apoorvapendse commented 4 days ago

Thanks for the feedback. I'd like to collaborate with you to make the log level feature, if that's fine. Let me know how you are planning to approach it. I will read up on the documentation of slog in the meantime.

apoorvapendse commented 3 days ago

image

image

I've made the updations.

apoorvapendse commented 2 days ago

Thank you for the contribution! I did the final touches by myself to speed up the process of merging this.

Thanks a lot @Acconut!