Skip to content

Commit

Permalink
Fixes for logs
Browse files Browse the repository at this point in the history
  • Loading branch information
auduny committed Mar 20, 2024
1 parent 9bda86c commit 1de585f
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions varnishprom.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ func main() {
}

if *logEnabled {
slog.Info("Starting varnishlog parser, looking for '" + *logKey + "' keywords")
slog.Info("Starting varnishlog parser", "logkey", *logKey)
// Start varnishlog as a subprocess
varnishlog := exec.Command("varnishlog", "-i", "VCL_Log")
varnishlogOutput, err := varnishlog.StdoutPipe()
Expand Down Expand Up @@ -255,7 +255,7 @@ func main() {
varnishadmOutput, err := varnishadm.Output()

if err != nil {
slog.Warn("Error running varnishadm: ", err)
slog.Warn("Error running varnishadm", "err", err)
slog.Warn(fmt.Sprintf("varnishadm -T %s -S %s banner", *adminHost, *secretsFile))
break
}
Expand Down Expand Up @@ -307,7 +307,7 @@ func main() {
}
}
if parsedVcl != activeVcl {
slog.Info("Active VCL changed from %s to %s", activeVcl, parsedVcl)
slog.Info(fmt.Sprintf("Active VCL changed from %s to %s", activeVcl, parsedVcl))
activeVcl = parsedVcl
}

Expand All @@ -317,7 +317,7 @@ func main() {
gitCmd := exec.Command("git", "-C", *gitCheck, "log", "-n", "1", "--pretty=format:%H")
gitCmdOutput, err := gitCmd.Output()
if err != nil {
slog.Warn("Error running git: ", "err", err)
slog.Warn("Error running git: ", "error", err)
break
}
commitHash = string(gitCmdOutput)
Expand All @@ -332,11 +332,11 @@ func main() {
// Get a pipe connected to the command's standard output.
varnishstatOutput, err := varnishstat.StdoutPipe()
if err != nil {
slog.Warn("Failed varnishstat:", err)
slog.Warn("Failed varnishstat:", "error", err)
break
}
if err := varnishstat.Start(); err != nil {
slog.Warn("Failed starting varnishstat:", err)
slog.Warn("Failed starting varnishstat:", "error", err)
break
}

Expand Down Expand Up @@ -441,7 +441,7 @@ func main() {
// Add more conditions as needed.
}
if err := varnishstat.Wait(); err != nil {
slog.Warn("Error waiting for varnishstat: ", err)
slog.Warn("Error waiting for varnishstat", "error", err)
}
mutex.Unlock()
}
Expand All @@ -454,7 +454,7 @@ func main() {
http.Handle(*path, promhttp.Handler())
err := http.ListenAndServe(*listen, nil)
if err != nil {
slog.Error("Failed to start server:", err)
slog.Error("Failed to start server:", "error", err)
}
} else {
slog.Error("Not starting log or statsparser. Enable -l (log) -s (stats) or both on the commandline")
Expand Down

0 comments on commit 1de585f

Please sign in to comment.