From 778ad6927bf456b9c57321f93b4f337b55d163ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Mon, 18 Jul 2022 15:37:07 +0200 Subject: [PATCH] Manager: nicer logging of its own URLs Log the URLs in an easier to read and also easier-to-copy-paste format. --- cmd/flamenco-manager/main.go | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/cmd/flamenco-manager/main.go b/cmd/flamenco-manager/main.go index 998fa007..ac4850ac 100644 --- a/cmd/flamenco-manager/main.go +++ b/cmd/flamenco-manager/main.go @@ -142,9 +142,7 @@ func runFlamencoManager() bool { if err != nil { log.Fatal().Err(err).Msg("unable to figure out my own URL") } - for _, url := range urls { - log.Info().Stringer("url", &url).Msg("possble URL at which to reach Flamenco Manager") - } + logURLs(urls) ssdp := makeAutoDiscoverable(urls) @@ -620,3 +618,15 @@ func registerOAPIBodyDecoders() { openapi3filter.RegisterBodyDecoder("image/jpeg", 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()) + } +}