diff options
author | Vincent Ambo <tazjin@google.com> | 2019-10-06T02·18+0100 |
---|---|---|
committer | Vincent Ambo <github@tazj.in> | 2019-10-06T22·05+0100 |
commit | 6f148f789f43bf753b345b039d01d8a429f194e9 (patch) | |
tree | 87569dd6d0d351822c926c250a20ed99e1f4452c /tools/nixery/server/config/pkgsource.go | |
parent | f77c93b6aeb3e847fe00099ea5c52dc98cf74b4d (diff) |
refactor(server): Convert existing log entries to structured format
This rewrites all existing log statements into the structured logrus format. For consistency, all errors are always logged separately from the primary message in a field called `error`. Only the "info", "error" and "warn" severities are used.
Diffstat (limited to 'tools/nixery/server/config/pkgsource.go')
-rw-r--r-- | tools/nixery/server/config/pkgsource.go | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/tools/nixery/server/config/pkgsource.go b/tools/nixery/server/config/pkgsource.go index 98719ecceabb..3a817f3d76d3 100644 --- a/tools/nixery/server/config/pkgsource.go +++ b/tools/nixery/server/config/pkgsource.go @@ -132,21 +132,30 @@ func (p *PkgsPath) CacheKey(pkgs []string, tag string) string { // specified, the Nix code will default to a recent NixOS channel. func pkgSourceFromEnv() (PkgSource, error) { if channel := os.Getenv("NIXERY_CHANNEL"); channel != "" { - log.Printf("Using Nix package set from Nix channel %q\n", channel) + log.WithFields(log.Fields{ + "channel": channel, + }).Info("using Nix package set from Nix channel or commit") + return &NixChannel{ channel: channel, }, nil } if git := os.Getenv("NIXERY_PKGS_REPO"); git != "" { - log.Printf("Using Nix package set from git repository at %q\n", git) + log.WithFields(log.Fields{ + "repo": git, + }).Info("using NIx package set from git repository") + return &GitSource{ repository: git, }, nil } if path := os.Getenv("NIXERY_PKGS_PATH"); path != "" { - log.Printf("Using Nix package set from path %q\n", path) + log.WithFields(log.Fields{ + "path": path, + }).Info("using Nix package set at local path") + return &PkgsPath{ path: path, }, nil |