refactor(logs): use zerolog instead of log (#797)

fix(logs): use zerolog instead of log
This commit is contained in:
soup 2023-03-30 22:04:44 +02:00 committed by GitHub
parent c2fcd91da7
commit 37261c9432
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -4,7 +4,6 @@ import (
"bufio" "bufio"
"io" "io"
"io/fs" "io/fs"
"log"
"net/http" "net/http"
"os" "os"
"path" "path"
@ -19,6 +18,7 @@ import (
"github.com/dustin/go-humanize" "github.com/dustin/go-humanize"
"github.com/go-chi/chi/v5" "github.com/go-chi/chi/v5"
"github.com/go-chi/render" "github.com/go-chi/render"
"github.com/rs/zerolog/log"
) )
type logsHandler struct { type logsHandler struct {
@ -153,7 +153,7 @@ func SanitizeLogFile(filePath string, output io.Writer) error {
if err != nil { if err != nil {
if err != io.EOF { if err != io.EOF {
log.Printf("Error reading line from input file: %v", err) log.Error().Msgf("Error reading line from input file: %v", err)
} }
break break
} }
@ -180,7 +180,7 @@ func SanitizeLogFile(filePath string, output io.Writer) error {
// Write the sanitized line to the writer // Write the sanitized line to the writer
if _, err = writer.WriteString(line); err != nil { if _, err = writer.WriteString(line); err != nil {
log.Printf("Error writing line to output: %v", err) log.Error().Msgf("Error writing line to output: %v", err)
return err return err
} }
} }