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.
This commit is contained in:
parent
f77c93b6ae
commit
6f148f789f
7 changed files with 243 additions and 54 deletions
|
@ -172,8 +172,14 @@ func (c *closure) ID() int64 {
|
|||
|
||||
var nixRegexp = regexp.MustCompile(`^/nix/store/[a-z0-9]+-`)
|
||||
|
||||
// PackageFromPath returns the name of a Nix package based on its
|
||||
// output store path.
|
||||
func PackageFromPath(path string) string {
|
||||
return nixRegexp.ReplaceAllString(path, "")
|
||||
}
|
||||
|
||||
func (c *closure) DOTID() string {
|
||||
return nixRegexp.ReplaceAllString(c.Path, "")
|
||||
return PackageFromPath(c.Path)
|
||||
}
|
||||
|
||||
// bigOrPopular checks whether this closure should be considered for
|
||||
|
@ -321,7 +327,10 @@ func dominate(budget int, graph *simple.DirectedGraph) []Layer {
|
|||
})
|
||||
|
||||
if len(layers) > budget {
|
||||
log.Printf("Ideal image has %v layers, but budget is %v\n", len(layers), budget)
|
||||
log.WithFields(log.Fields{
|
||||
"layers": len(layers),
|
||||
"budget": budget,
|
||||
}).Info("ideal image exceeds layer budget")
|
||||
}
|
||||
|
||||
for len(layers) > budget {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue