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