commit 6306164c020de6df16af94ec2a60a964eae67b5b
parent 810ad8f7764be72dcb47d3891436e5c4e288c2f4
Author: Andreas Gruhler <andreas.gruhler@adfinis.com>
Date: Sun, 17 Sep 2023 00:02:52 +0200
feat: less verbose logging
Diffstat:
1 file changed, 1 insertion(+), 8 deletions(-)
diff --git a/server.go b/server.go
@@ -9,7 +9,6 @@ import (
"hivedav/config"
"hivedav/caldav"
"fmt"
- "github.com/pquerna/termchalk/ansistyle"
"github.com/pquerna/termchalk/prettytable"
_ "github.com/mattn/go-sqlite3"
"database/sql"
@@ -148,8 +147,6 @@ func (s *Server) Week(w http.ResponseWriter, req *http.Request, ps httprouter.Pa
if strings.Contains(userAgent, "curl") {
w.Header().Set("Content-Type", "text/plain")
- io.WriteString(w, ansistyle.Bold.Open+"Welcome to the "+ansistyle.Bold.Close)
- io.WriteString(w, ansistyle.BgRed.Open+"hive!"+ansistyle.BgBlue.Close+"\n")
io.WriteString(w, fmt.Sprintf("Serving week %d of year %d\n", week, year))
// TODO: Make heading date format configurable, start of week, etc..
@@ -180,7 +177,6 @@ func (s *Server) Week(w http.ResponseWriter, req *http.Request, ps httprouter.Pa
start := timeIt.Add(time.Hour * time.Duration((d-1)*24 + h)).Add(1 * time.Minute).UTC().Format(sqlDateFmt)
end := timeIt.Add(time.Hour * time.Duration((d-1)*24 + h+1)).Add(-1 * time.Minute).UTC().Format(sqlDateFmt)
avi, err := s.available(start, end)
- log.Printf("Getting availability on day '%v' - '%v'\n", start, end)
if err != nil {
log.Printf("Error getting availability on day '%d' hour '%d'\n", d, h)
return
@@ -200,6 +196,7 @@ func (s *Server) Week(w http.ResponseWriter, req *http.Request, ps httprouter.Pa
availability[4])
//timeIt = timeIt.Add(time.Hour)
}
+ io.WriteString(w, fmt.Sprintf("HiveDAV %s\n", hivedavVersion))
io.WriteString(w, fmt.Sprint(pt))
} else {
@@ -225,7 +222,6 @@ func (s *Server) updateAvailability(calData []caldav.CalData) error {
// Walk through events and store start/end time in the database
for _, event := range calData {
- log.Printf("%v\n", event.Data)
dec := ical.NewDecoder(strings.NewReader(event.Data))
cal, err := dec.Decode()
var (
@@ -252,7 +248,6 @@ func (s *Server) updateAvailability(calData []caldav.CalData) error {
for _, child := range c.Children {
//tzOffsetFrom = child.Props.Get(ical.PropTimezoneOffsetFrom).Value;
tzOffsetTo = child.Props.Get(ical.PropTimezoneOffsetTo).Value;
- log.Println("tzOffsetTo:", tzOffsetTo)
}
}
}
@@ -266,11 +261,9 @@ func (s *Server) updateAvailability(calData []caldav.CalData) error {
//tzOffsetDuration = time.Second * time.Duration(-1 * offset)
//log.Printf("Cannot find time zone offset, using local offset: %v\n", tzOffsetDuration)
tzOffsetDuration = time.Duration(0)
- log.Println("Cannot find time zone offset, using 0 offset.")
} else {
tzOffsetDurationInt, _ := strconv.Atoi(matches[1])
tzOffsetDuration = time.Hour * time.Duration(tzOffsetDurationInt)
- log.Printf("Found time zone offset: %v\n", tzOffsetDuration)
// reset to UTC
tzOffsetDuration = time.Hour * time.Duration(-1 * tzOffsetDurationInt)
}