From edd8cacf321474aa71a1fd41d6eaa7515f3f981a Mon Sep 17 00:00:00 2001 From: Stefan Wichmann Date: Tue, 21 Mar 2017 10:15:44 +0100 Subject: [PATCH] Be less verbose about interval changes --- day.go | 4 +--- interval.go | 3 +-- kelvin.go | 5 ++--- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/day.go b/day.go index 8b3f803..158db30 100644 --- a/day.go +++ b/day.go @@ -43,12 +43,10 @@ func (day *Day) updateCyclic(configuration Configuration, location Geolocation, currentInterval, err := day.currentInterval(time.Now()) if err != nil { // should only happen when day has ended - log.Println("NEW DAY?", err.Error()) day.updateForDay(time.Now(), configuration, location) } else { channel <- currentInterval timeLeftInInterval := currentInterval.End.Time.Sub(time.Now()) - log.Printf("DAY - Time left in interval %v - %v: %v\n", currentInterval.Start.Time.Format("15:04"), currentInterval.End.Time.Format("15:04"), timeLeftInInterval) time.Sleep(timeLeftInInterval + (1 * time.Second)) } } @@ -87,7 +85,7 @@ func (day *Day) updateForDay(date time.Time, configuration Configuration, locati func (day *Day) currentInterval(timestamp time.Time) (Interval, error) { // check if timestamp respresents the current day if timestamp.After(day.endOfDay) { - return Interval{TimeStamp{time.Now(), 0, 0}, TimeStamp{time.Now(), 0, 0}}, errors.New("DAY - No current interval as the requested timestamp respresents a different day") + return Interval{TimeStamp{time.Now(), 0, 0}, TimeStamp{time.Now(), 0, 0}}, errors.New("No current interval as the requested timestamp respresents a different day") } // if we are between todays sunrise and sunset, return daylight interval diff --git a/interval.go b/interval.go index d31b3e8..f7fa104 100644 --- a/interval.go +++ b/interval.go @@ -34,7 +34,7 @@ type Interval struct { const lightStateUpdateIntervalInMinutes = 1 func (interval *Interval) updateCyclic(channel chan<- LightState) { - log.Printf("INTERVAL - Managing light state for interval %v to %v\n", interval.Start.Time.Format("15:04"), interval.End.Time.Format("15:04")) + log.Printf("Managing lights for interval %v to %v\n", interval.Start.Time.Format("15:04"), interval.End.Time.Format("15:04")) // Now that we are responsible for the correct light states, send out the initial valid state currentLightState := interval.calculateLightStateInInterval(time.Now()) @@ -55,7 +55,6 @@ func (interval *Interval) updateCyclic(channel chan<- LightState) { // check if the interval ended if time.Now().After(interval.End.Time) { - log.Printf("INTERVAL - Interval %v - %v ended. ", interval.Start.Time.Format("15:04"), interval.End.Time.Format("15:04")) intervalEnded = true } } diff --git a/kelvin.go b/kelvin.go index f027370..4a62a71 100644 --- a/kelvin.go +++ b/kelvin.go @@ -29,7 +29,7 @@ import "os" var applicationVersion = "development" func main() { - log.Printf("🚀 Kelvin %v starting up...\n", applicationVersion) + log.Printf("Kelvin %v starting up... 🚀\n", applicationVersion) go CheckForUpdate(applicationVersion) go handleSIGHUP() @@ -78,7 +78,7 @@ func main() { // Ignore devices that don't support dimming and colors // TODO Move to bridge.go if !hueLight.dimmable && !hueLight.supportsXYColor && !hueLight.supportsColorTemperature { - log.Printf("⌘ Device %v doesn't support any functionality we use. Exlude it from unnessesary polling.\n", hueLight.name) + log.Printf("Device %v doesn't support any functionality we use. Exlude it from unnessesary polling.\n", hueLight.name) continue } lightChannel := make(chan LightState, 1) @@ -103,7 +103,6 @@ func main() { light <- state } case interval := <-intervalChannel: - log.Printf("⌘ - New interval received: %v - %v\n", interval.Start.Time.Format("15:04"), interval.End.Time.Format("15:04")) go interval.updateCyclic(lightStateChannel) } }