feat: integrate zerolog for structured logging and replace fmt with logger
All checks were successful
Release / Build versioned release (push) Successful in 20s
All checks were successful
Release / Build versioned release (push) Successful in 20s
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
package steamcache
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"s1d3sw1ped/SteamCache2/steamcache/logger"
|
||||
"s1d3sw1ped/SteamCache2/vfs"
|
||||
"s1d3sw1ped/SteamCache2/vfs/cachestate"
|
||||
"time"
|
||||
@@ -17,7 +17,7 @@ func randomgc(vfss vfs.VFS, stats []*vfs.FileInfo) int64 {
|
||||
err := vfss.Delete(randfile.Name())
|
||||
if err != nil {
|
||||
// If we failed to delete the file, log it and return 0
|
||||
// fmt.Printf("Failed to delete %s: %v", randfile.Name(), err)
|
||||
// logger.Logger.Error().Err(err).Msgf("Failed to delete %s", randfile.Name())
|
||||
return 0
|
||||
}
|
||||
|
||||
@@ -39,7 +39,12 @@ func memorygc(vfss vfs.VFS, size int) {
|
||||
}
|
||||
}
|
||||
|
||||
fmt.Printf("GC of %s took %v to reclaim %s by deleting %d files", vfss.Name(), time.Since(tstart), units.HumanSize(float64(reclaimed)), deletions)
|
||||
logger.Logger.Info().
|
||||
Str("name", vfss.Name()).
|
||||
Str("duration", time.Since(tstart).String()).
|
||||
Str("reclaimed", units.HumanSize(float64(reclaimed))).
|
||||
Int("deletions", deletions).
|
||||
Msgf("GC")
|
||||
}
|
||||
|
||||
func diskgc(vfss vfs.VFS, size int) {
|
||||
@@ -57,7 +62,12 @@ func diskgc(vfss vfs.VFS, size int) {
|
||||
}
|
||||
}
|
||||
|
||||
fmt.Printf("GC of %s took %v to reclaim %s by deleting %d files", vfss.Name(), time.Since(tstart), units.HumanSize(float64(reclaimed)), deletions)
|
||||
logger.Logger.Info().
|
||||
Str("name", vfss.Name()).
|
||||
Str("duration", time.Since(tstart).String()).
|
||||
Str("reclaimed", units.HumanSize(float64(reclaimed))).
|
||||
Int("deletions", deletions).
|
||||
Msgf("GC")
|
||||
}
|
||||
|
||||
func cachehandler(fi *vfs.FileInfo, cs cachestate.CacheState) bool {
|
||||
|
||||
Reference in New Issue
Block a user