diff --git a/config/config.go b/config/config.go index 71bd8de..992d939 100644 --- a/config/config.go +++ b/config/config.go @@ -3,6 +3,7 @@ package config import ( "errors" "fmt" + "log" "strings" "th7/data/config" "th7/data/thermocouple" @@ -80,7 +81,7 @@ func Load() (config.Config, error) { tc, err := GetThermocoupleType(v.GetString(head + ".type")) if err != nil { - fmt.Printf("%s.type=%s\n", head, v.GetString(head+".type")) + log.Printf("%s.type=%s\n", head, v.GetString(head+".type")) return cfg, err } diff --git a/db/influxdb.go b/db/influxdb.go index c309740..c3eed13 100644 --- a/db/influxdb.go +++ b/db/influxdb.go @@ -4,6 +4,7 @@ import ( "context" "errors" "fmt" + "log" "os" "strings" "sync" @@ -84,7 +85,7 @@ func NewInfluxDBAdapter(config config.Config) (*InfluxDBAdapter, error) { ` _, err = adapter.client.Query(initContext, query) if err != nil { - fmt.Println("Error initialising InfluxDB. Check details/network connection.") + log.Println("Error initialising InfluxDB. Check details/network connection.") return &adapter, err } @@ -124,7 +125,7 @@ func (ad *InfluxDBAdapter) Save(channels []core.Channel) error { // need at least 1 iteration to bother sending data to influx server if logged == 0 { - fmt.Printf("[%s] InfluxDB: nothing to do.\n", time.Now().Format(time.DateTime)) + log.Printf("[%s] InfluxDB: nothing to do.\n", time.Now().Format(time.DateTime)) return nil } @@ -136,7 +137,7 @@ func (ad *InfluxDBAdapter) Save(channels []core.Channel) error { return err } - fmt.Printf("[%s] InfluxDB: logged %d channels OK\n", time.Now().Format(time.DateTime), logged) + log.Printf("[%s] InfluxDB: logged %d channels OK\n", time.Now().Format(time.DateTime), logged) return nil } diff --git a/main.go b/main.go index e97f27a..8f1425e 100644 --- a/main.go +++ b/main.go @@ -1,7 +1,6 @@ package main import ( - "fmt" "log" "os" "os/signal" @@ -55,7 +54,7 @@ func main() { defer dbPort.Close() color.Set(color.FgHiRed) - fmt.Printf("Started on: %s\n", time.Now().Format(time.DateTime)) + log.Printf("Started on: %s\n", time.Now().Format(time.DateTime)) color.Unset() // if noweb is false and HTTP/REST API is enabled then start web service @@ -64,7 +63,7 @@ func main() { go apiPort.Run() color.Set(color.FgHiGreen) - fmt.Printf("TH7 API is live on http://localhost:%d/\n", cfg.API.Port) + log.Printf("TH7 API is live on http://localhost:%d/\n", cfg.API.Port) color.Unset() } diff --git a/pcb/dummy.go b/pcb/dummy.go index b681f69..01807a4 100644 --- a/pcb/dummy.go +++ b/pcb/dummy.go @@ -1,7 +1,7 @@ package pcb import ( - "fmt" + "log" "math/rand" "th7/data/pcb" "time" @@ -17,7 +17,7 @@ func NewDummyAdapter() (*DummyAdapter, error) { } func (d *DummyAdapter) Deinit() error { - fmt.Println("dummy pcb adapter deinit") + log.Println("dummy pcb adapter deinit") return nil }