debug logging improved

This commit is contained in:
milarin 2023-01-14 09:45:21 +01:00
parent d526e4d1db
commit 3817f3ac36
4 changed files with 6 additions and 6 deletions

BIN
.fuse_hidden000024c600000004 Executable file

Binary file not shown.

View File

@ -4,6 +4,7 @@ import (
"errors"
"fmt"
"io"
"log"
"os"
"path/filepath"
@ -38,7 +39,6 @@ func HandleParsedFile(parsedFile *model.ParsedFile) {
oldFilePrio, animeEpNotExistLocally := logic.GetAnimeEpProps(parsedFile.AnimeEpisode())
if !animeEpNotExistLocally || newFilePrio.Priority > oldFilePrio.Priority {
fmt.Println(animeEpNotExistLocally, newFilePrio, oldFilePrio)
go func(parsedFile *model.ParsedFile) {
if err := OrganizeAnimeEpisode(parsedFile); err != nil {
adverr.Println(err)
@ -52,7 +52,7 @@ func OrganizeAnimeEpisode(parsedFile *model.ParsedFile) error {
newFile := logic.GetAnimeEpFilepath(parsedFile.AnimeEpisode(), filepath.Ext(parsedFile.File))
lockFile := logic.GetAnimeEpFilepath(parsedFile.AnimeEpisode(), "lock")
fmt.Printf("move file '%s' to '%s'\n", oldFile, newFile)
log.Printf("move file '%s' to '%s'\n", oldFile, newFile)
if err := os.MkdirAll(filepath.Dir(newFile), os.ModePerm); err != nil {
return err
@ -96,7 +96,7 @@ func OrganizeAnimeEpisode(parsedFile *model.ParsedFile) error {
return err
}
fmt.Printf("file '%s' moved\n", newFile)
log.Printf("file '%s' moved\n", newFile)
return nil
}

View File

@ -1,7 +1,7 @@
package main
import (
"fmt"
"log"
"git.milar.in/nyaanime/logic"
"github.com/fsnotify/fsnotify"
@ -22,9 +22,9 @@ func main() {
fileHandled := HandleFile(file)
if fileHandled {
fmt.Println("file handled:", file)
log.Println("file handled:", file)
} else {
fmt.Println("file ignored:", file)
log.Println("file ignored:", file)
}
}
}

BIN
organizer Executable file

Binary file not shown.