all repos — flounder @ c0c3a51c0b50bdc8794a901f9c4cac9c4890dd52

A small site builder for the Gemini protocol

update log writing

every 2 hours
log writing logs
alex wennerberg alex@alexwennerberg.com
Sat, 02 Jan 2021 13:39:06 -0800
commit

c0c3a51c0b50bdc8794a901f9c4cac9c4890dd52

parent

cfafb492208f46510499512e66c64fbfd060af94

2 files changed, 3 insertions(+), 3 deletions(-)

jump to
M log.golog.go

@@ -231,7 +231,7 @@ return &result, nil

} func dumpLogs() { - fmt.Println("Writing missing logs to database") + log.Println("Writing missing logs to database") db := getAnalyticsDB() var maxTime string row := db.QueryRow(`SELECT timestamp from log order by timestamp desc limit 1`)

@@ -264,7 +264,7 @@ }

ll.insertInto(db) counter += 1 } - fmt.Printf("Wrote %d logs\n", counter) + log.Printf("Wrote %d logs\n", counter) } func rotateLogs() {
M main.gomain.go

@@ -51,7 +51,7 @@

// handle background tasks s1 := gocron.NewScheduler(time.UTC) if c.AnalyticsDBFile != "" { - s1.Every(1).Day().Do(dumpLogs) // TODO Dont do on start? + s1.Every(2).Hour().Do(dumpLogs) // TODO Dont do on start? } switch args[0] {