From 9dbc08c5353f9d87e1ee94761caea69b274a241a Mon Sep 17 00:00:00 2001 From: kayos Date: Sat, 15 May 2021 16:17:45 -0700 Subject: [PATCH] fixing logging --- src/scanStuff/scanStuff.go | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/scanStuff/scanStuff.go b/src/scanStuff/scanStuff.go index add0f0a..5b39a5f 100644 --- a/src/scanStuff/scanStuff.go +++ b/src/scanStuff/scanStuff.go @@ -158,7 +158,7 @@ func (s *Scan) Start() error { }) - log.Info().Str("Adapter", "Attempting Connection").Msg("ADAPTER_STATUS") + sublog.Info().Str("Adapter", "Attempting Connection").Msg("ADAPTER_STATUS") TargetDevice, err := projVars.ScanAdapter.Connect(result.Address, bluetooth.ConnectionParams{}) @@ -170,23 +170,23 @@ func (s *Scan) Start() error { select { case <-endTime: - log.Info().Str("Adapter", "Connection Timeout").Msg("ADAPTER_STATUS") + sublog.Info().Str("Adapter", "Connection Timeout").Msg("ADAPTER_STATUS") TargetDevice.Disconnect() endTime = nil default: - log.Info().Str("Adapter", "Working...").Msg("ADAPTER_STATUS") + sublog.Info().Str("Adapter", "Working...").Msg("ADAPTER_STATUS") } } if err != nil { - log.Err(err).Msg("CONNECTION_ERROR") + sublog.Err(err).Msg("CONNECTION_ERROR") } if projVars.ConnectedToTarget == true { var targetServices []bluetooth.DeviceService - log.Info().Str("Adapter", "Attempting to Read Target Services").Msg("ADAPTER_STATUS") + sublog.Info().Str("Adapter", "Attempting to Read Target Services").Msg("ADAPTER_STATUS") var timeDealy = 50 * time.Millisecond var tick <-chan time.Time @@ -196,11 +196,11 @@ func (s *Scan) Start() error { select { case <-endTime: - log.Info().Str("Adapter", "Connection Timeout").Msg("ADAPTER_STATUS") + sublog.Info().Str("Adapter", "Connection Timeout").Msg("ADAPTER_STATUS") TargetDevice.Disconnect() endTime = nil default: - log.Debug().Str("Adapter", "Working...").Msg("ADAPTER_STATUS") + sublog.Debug().Str("Adapter", "Working...").Msg("ADAPTER_STATUS") } } @@ -209,7 +209,7 @@ func (s *Scan) Start() error { targetServices, err = TargetDevice.DiscoverServices(nil) if err != nil { - log.Debug().Err(err).Msg("DISCOVER_SERVICE_ERROR") + sublog.Debug().Err(err).Msg("DISCOVER_SERVICE_ERROR") } for SerReadPos, srvcs := range targetServices { @@ -220,7 +220,7 @@ func (s *Scan) Start() error { //ReadPos, _ := char.Read(Charbuf) - log.Debug().Str("Adapter", "Attempting to Retrieve Characteristic List").Msg("ADAPTER_STATUS") + sublog.Debug().Str("Adapter", "Attempting to Retrieve Characteristic List").Msg("ADAPTER_STATUS") chars, _ := srvcs.DiscoverCharacteristics(nil) @@ -240,7 +240,7 @@ func (s *Scan) Start() error { } TargetDevice.Disconnect() - log.Info().Str("Adapter", "Successfully Disconnected From Target").Msg("ADAPTER_STATUS") + sublog.Info().Str("Adapter", "Successfully Disconnected From Target").Msg("ADAPTER_STATUS") projVars.ConnectedToTarget = false } }