use propper logger
This commit is contained in:
@@ -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")
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user