Skip to content

Commit

Permalink
[preprocessor/folder] use log instead of fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
williamchong committed May 31, 2024
1 parent 9fabac2 commit c2cdaa7
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions preprocessor/folder/folder.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package folder

import (
"fmt"
"log"
"os"
"path/filepath"

Expand All @@ -23,7 +23,7 @@ func scanSyncDirectory(subPath string) ([]string, error) {
}
if shouldIncludeFile(info.Name()) {
fileList = append(fileList, path)
fmt.Println("Found: " + path)
log.Println("Found: " + path)
return nil
}
return nil
Expand All @@ -40,9 +40,9 @@ func Run(args []string) error {
for _, filePath := range fileList {
cid, err := handleNewFile(filePath)
if err != nil {
fmt.Println(err)
log.Println(err)
} else {
fmt.Printf("File %s uploaded to webhook with CID %s\n", filePath, cid)
log.Printf("File %s uploaded to webhook with CID %s\n", filePath, cid)
}
}

Expand Down Expand Up @@ -70,23 +70,23 @@ func Run(args []string) error {
defer file.Close()
fileInfo, err := file.Stat()
if err != nil {
fmt.Println("error getting file info:", err)
log.Println("error getting file info:", err)
continue
}
if shouldIncludeFile(fileInfo.Name()) {
cid, err := handleNewFile(filePath)
if err != nil {
fmt.Println(err)
log.Println(err)
} else {
fmt.Printf("File %s uploaded to webhook with CID %s\n", filePath, cid)
log.Printf("File %s uploaded to webhook with CID %s\n", filePath, cid)
}
}
}
case err, ok := <-watcher.Errors:
if !ok {
return
}
fmt.Println("error:", err)
log.Println("error:", err)
}
}
}()
Expand Down

0 comments on commit c2cdaa7

Please sign in to comment.