From 513e79832ae5bd8e825eb4f5a2605b1c585eccd6 Mon Sep 17 00:00:00 2001 From: Gusted Date: Sun, 22 Jan 2023 18:52:21 +0000 Subject: [PATCH] Use correct log level for `CheckCanonicalDomain` (#162) - Currently any error generated by requesting the `.domains` file of a repository would be logged under the info log level, which isn't the correct log level when we exclude the not found error. - Use warn log level if the error isn't the not found error. Co-authored-by: Gusted Reviewed-on: https://codeberg.org/Codeberg/pages-server/pulls/162 Reviewed-by: Otto --- server/upstream/domains.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/server/upstream/domains.go b/server/upstream/domains.go index 0e29673..ba1c494 100644 --- a/server/upstream/domains.go +++ b/server/upstream/domains.go @@ -45,7 +45,11 @@ func (o *Options) CheckCanonicalDomain(giteaClient *gitea.Client, actualDomain, } } } else { - log.Info().Err(err).Msgf("could not read %s of %s/%s", canonicalDomainConfig, o.TargetOwner, o.TargetRepo) + if err != gitea.ErrorNotFound { + log.Error().Err(err).Msgf("could not read %s of %s/%s", canonicalDomainConfig, o.TargetOwner, o.TargetRepo) + } else { + log.Info().Err(err).Msgf("could not read %s of %s/%s", canonicalDomainConfig, o.TargetOwner, o.TargetRepo) + } } domains = append(domains, o.TargetOwner+mainDomainSuffix) if domains[len(domains)-1] == actualDomain {