fixing logging
This commit is contained in:
parent
90745b771e
commit
9dbc08c535
@ -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
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user