restic / rest-server

Rest Server is a high performance HTTP server that implements restic's REST backend API.
BSD 2-Clause "Simplified" License
922 stars 138 forks source link

feat: allow logging to stdout, stderr #217

Closed HeikoSchlittermann closed 1 year ago

HeikoSchlittermann commented 1 year ago

What is the purpose of this change? What does it change?

The --log option accepts "stdout", "stderr" as filenames. This prevents rest-server from opening these files, it simply writes the logs to the STDOUT or STDERR stream provided by the caller.

BREAKING in case the user really used "stdout", "stderr" to specify file names, you'll need to update your rest-server invocation to use "./stdout", "./stderr".

Was the change discussed in an issue or in the forum before?

No.

Checklist

MichaelEischer commented 1 year ago

What is the use case for logging to stderr? For stdout a pretty common name would be "-", that is --log -.

HeikoSchlittermann commented 1 year ago

I currently do not have a use case for logging to STDERR. I suggested it for both (stderr, stdout) just for completeness. Logging to STDOUT though I have a use case for: I'd like to have Systemd capture all the output. Depending on the invocation, rest-server can't (re)open STDOUT (permissions).

I'm fine with --log - too. But IMHO --log stdout is more self-explanatory. (Using --log /dev/stdout with built-in magic would assume, that /dev/stdout is identical to the STDOUT provided by the caller.)