summaryrefslogtreecommitdiff
path: root/add.go
diff options
context:
space:
mode:
Diffstat (limited to 'add.go')
-rw-r--r--add.go11
1 files changed, 5 insertions, 6 deletions
diff --git a/add.go b/add.go
index 88d4ceb..01ff836 100644
--- a/add.go
+++ b/add.go
@@ -1,7 +1,6 @@
package main
import (
- "fmt"
"os"
"path/filepath"
@@ -14,15 +13,15 @@ import (
func addFile(filename string) (*chatpb.Chats, error) {
data, err := os.ReadFile(filename)
if err != nil {
- return nil, fmt.Errorf("failed to read file %s: %w", filename, err)
+ return nil, log.Errorf("failed to read file %s: %w", filename, err)
}
logData, err := chatpb.UnmarshalChatsTEXT(data)
if err != nil {
- return nil, fmt.Errorf("failed to unmarshal log file %s: %w", filename, err)
+ return nil, log.Errorf("failed to unmarshal log file %s: %w", filename, err)
}
- log.Infof("Successfully parsed log file: %s", filename)
+ log.Info("Successfully parsed log file: %s", filename)
// Get the directory of the log file to resolve relative content paths.
logDir := filepath.Dir(filename)
@@ -35,7 +34,7 @@ func addFile(filename string) (*chatpb.Chats, error) {
contentPath := filepath.Join(logDir, contentFile)
contentBytes, err := os.ReadFile(contentPath)
if err != nil {
- entry.Content = fmt.Sprintf("--- ERROR: Could not read content file %s: %v ---", contentPath, err)
+ entry.Content = log.Sprintf("--- ERROR: Could not read content file %s: %v ---", contentPath, err)
} else {
entry.Content = string(contentBytes)
}
@@ -48,7 +47,7 @@ func addFile(filename string) (*chatpb.Chats, error) {
snippetPath := filepath.Join(logDir, snippetFile)
contentBytes, err := os.ReadFile(snippetPath)
if err != nil {
- snippet.Content = fmt.Sprintf("--- ERROR: Could not read snippet file %s: %v ---", snippetPath, err)
+ snippet.Content = log.Sprintf("--- ERROR: Could not read snippet file %s: %v ---", snippetPath, err)
} else {
snippet.Content = string(contentBytes)
}