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

@@ -3,6 +3,7 @@ package oplcli
import (
"bufio"
"fmt"
"log/slog"
"os"
"strings"
)
@@ -16,15 +17,16 @@ func loadGamelist(filepath string) (map[string]string, error) {
gameList := make(map[string]string)
lineNum := 0
scanner := bufio.NewScanner(file)
for scanner.Scan() {
line := scanner.Text()
lineNum++
substrings := strings.SplitN(line, " ", 2)
if len(substrings) != 2 {
// TODO: something in the gamelist file is not formatted right
fmt.Printf("Malformed: %s\n", line)
slog.Warn("Line in gamelist is malformed", "line", lineNum)
continue
}