refactor: replace log statements with fmt for console output
All checks were successful
Release / Build versioned release (push) Successful in 16s

This commit is contained in:
2025-01-21 20:56:58 -06:00
parent c370e80888
commit 62f7a38295
3 changed files with 16 additions and 14 deletions

View File

@@ -1,10 +1,11 @@
package steamcache
import (
"fmt"
"io"
"log"
"net/http"
"net/url"
"os"
"s1d3sw1ped/SteamCache2/steamcache/avgcachestate"
"s1d3sw1ped/SteamCache2/vfs"
"s1d3sw1ped/SteamCache2/vfs/cache"
@@ -79,7 +80,7 @@ func New(address string, memorySize string, memoryMultiplier int, diskSize strin
}
func (sc *SteamCache) Run() {
log.Printf("SteamCache2 running on %s", sc.address)
fmt.Printf("SteamCache2 running on %s", sc.address)
sc.mu.Lock()
sc.dirty = true
@@ -95,7 +96,8 @@ func (sc *SteamCache) Run() {
err := http.ListenAndServe(sc.address, sc)
if err != nil {
log.Fatal(err)
fmt.Println(err)
os.Exit(1)
}
}
@@ -103,8 +105,8 @@ func (sc *SteamCache) LogStats() {
sc.mu.Lock()
defer sc.mu.Unlock()
if sc.dirty {
log.Printf(
"SteamCache2 %s: (%d) %s/%s %s: (%d) %s/%s Hitrate: %f%%",
fmt.Printf(
"%s: (%d) %s/%s %s: (%d) %s/%s Hitrate: %f%%",
sc.memory.Name(), len(sc.memory.StatAll()), units.HumanSize(float64(sc.memory.Size())), units.HumanSize(float64(sc.memory.Capacity())),
sc.disk.Name(), len(sc.disk.StatAll()), units.HumanSize(float64(sc.disk.Size())), units.HumanSize(float64(sc.disk.Capacity())),
sc.hits.Avg()*100,
@@ -139,7 +141,7 @@ func (sc *SteamCache) ServeHTTP(w http.ResponseWriter, r *http.Request) {
// tstart := time.Now()
// defer func() {
// log.Printf("%s %s %s took %s", r.Method, r.URL.String(), w.Header().Get("X-LanCache-Status"), time.Since(tstart))
// fmt.Printf("%s %s %s took %s", r.Method, r.URL.String(), w.Header().Get("X-LanCache-Status"), time.Since(tstart))
// }()
sc.mu.Lock()