aboutsummaryrefslogtreecommitdiffstats
path: root/types.go
diff options
context:
space:
mode:
authorterminaldweller <devi@terminaldweller.com>2024-09-01 02:13:40 +0000
committerterminaldweller <devi@terminaldweller.com>2024-09-01 02:13:40 +0000
commit7c8e0160eefa9f90b74b729086dc44f108539083 (patch)
treeecbb9760ead142557ba6cbb4f46d6a0420f7ee28 /types.go
parentfixed a bug where we would still get previously seen feeds, updated the readme (diff)
downloadmilla-7c8e0160eefa9f90b74b729086dc44f108539083.tar.gz
milla-7c8e0160eefa9f90b74b729086dc44f108539083.zip
added the url to the rss output. fixed a bug with the rss feeds where different rss feeds where not being handled correctly. added new logging functions
Diffstat (limited to 'types.go')
-rw-r--r--types.go20
1 files changed, 20 insertions, 0 deletions
diff --git a/types.go b/types.go
index 2206eb2..79ef000 100644
--- a/types.go
+++ b/types.go
@@ -2,6 +2,8 @@ package main
import (
"context"
+ "log"
+ "runtime"
"time"
"github.com/jackc/pgx/v5/pgxpool"
@@ -191,3 +193,21 @@ type RSSConfig struct {
Feeds []FeedConfig `json:"feeds"`
Period int `json:"period"`
}
+
+func LogError(err error) {
+ fn, file, line, ok := runtime.Caller(1)
+ if ok {
+ log.Printf("%s: %s-%d >>> %v", runtime.FuncForPC(fn).Name(), file, line, err)
+ } else {
+ log.Print(err)
+ }
+}
+
+func LogErrorFatal(err error) {
+ fn, file, line, ok := runtime.Caller(1)
+ if ok {
+ log.Fatalf("%s: %s-%d >>> %v", runtime.FuncForPC(fn).Name(), file, line, err)
+ } else {
+ log.Fatal(err)
+ }
+}