diff calsync/main.go @ 60:3b0595c2bf03

logging and small refactors
author drewp@bigasterisk.com
date Fri, 06 Sep 2024 16:41:48 -0700
parents 1f8e66cb0108
children 8aee4f5c4bdd
line wrap: on
line diff
--- a/calsync/main.go	Fri Sep 06 16:37:04 2024 -0700
+++ b/calsync/main.go	Fri Sep 06 16:41:48 2024 -0700
@@ -28,9 +28,9 @@
 )
 
 func main() {
+	startLogging()
 	ctx := context.Background()
 
-	log.SetFlags(log.LstdFlags | log.Lshortfile)
 	gc, err := gcalclient.New(ctx)
 	if err != nil {
 		log.Fatal(err)
@@ -43,7 +43,8 @@
 	}
 	defer mc.Close()
 
-	// todo: if a cal is deleted, nothing touches its db events ever again.
+	// todo: if a cal is deleted, we don't clean up its events, even upon
+	// restart.
 	err = updateMongoCalsToMatchGoogleOnce(mc, gc)
 	if err != nil {
 		log.Fatal(err)
@@ -68,6 +69,12 @@
 	log.Fatal(http.ListenAndServe(addr, nil))
 }
 
+func startLogging() {
+	log.SetFlags(log.LstdFlags | log.Lshortfile)
+	log.Println(`
+	==================================================
+                    calsync
+					----------------------------------------------`)
 }
 
 func homePage(w http.ResponseWriter, r *http.Request) {