Manager: nicer logging of its own URLs

Log the URLs in an easier to read and also easier-to-copy-paste format.
This commit is contained in:
Sybren A. Stüvel 2022-07-18 15:37:07 +02:00
parent 43e8f3f623
commit 778ad6927b

View File

@ -142,9 +142,7 @@ func runFlamencoManager() bool {
if err != nil { if err != nil {
log.Fatal().Err(err).Msg("unable to figure out my own URL") log.Fatal().Err(err).Msg("unable to figure out my own URL")
} }
for _, url := range urls { logURLs(urls)
log.Info().Stringer("url", &url).Msg("possble URL at which to reach Flamenco Manager")
}
ssdp := makeAutoDiscoverable(urls) ssdp := makeAutoDiscoverable(urls)
@ -620,3 +618,15 @@ func registerOAPIBodyDecoders() {
openapi3filter.RegisterBodyDecoder("image/jpeg", openapi3filter.FileBodyDecoder) openapi3filter.RegisterBodyDecoder("image/jpeg", openapi3filter.FileBodyDecoder)
openapi3filter.RegisterBodyDecoder("image/png", openapi3filter.FileBodyDecoder) openapi3filter.RegisterBodyDecoder("image/png", openapi3filter.FileBodyDecoder)
} }
func logURLs(urls []url.URL) {
log.Info().Int("count", len(urls)).Msg("possble URL at which to reach Flamenco Manager")
for _, url := range urls {
// Don't log this with something like `Str("url", url.String())`, because
// that puts `url=` in front of the URL. This can interfere with
// link-detection in the terminal. Having a space in front is much better,
// as that is guaranteed to count as word-delimiter for double-click
// word-selection.
log.Info().Msgf("- %s", url.String())
}
}