use propper logger

This commit is contained in:
2026-01-09 17:44:45 +01:00
parent 42a1080981
commit d3c277eb7f
5 changed files with 52 additions and 28 deletions

View File

@@ -2,6 +2,7 @@ package oplcli
import (
"fmt"
"log/slog"
"os"
"path/filepath"
"regexp"
@@ -11,7 +12,8 @@ import (
func scanGameFileForID(filename string) (string, error) {
file, err := os.Open(filename)
if err != nil {
return "", fmt.Errorf("failed to open file: %w", err)
slog.Error("Failed to open file", "file", filename, "err", err)
return "", err
}
defer file.Close()
@@ -20,11 +22,13 @@ func scanGameFileForID(filename string) (string, error) {
n, err := file.Read(buffer)
if err != nil && n == 0 {
return "", fmt.Errorf("failed to read file: %w", err)
slog.Error("Failed to read file", "file", file, "err", err)
return "", err
}
id, found := scanBufferForID(buffer[:n])
if !found {
slog.Error("No PS2 ID found in the file", "file", file)
return "", fmt.Errorf("no PS2 game ID found in file")
}