zones: add structured logs to zone scanning
Signed-off-by: Alejandro Mery <amery@jpi.io>
This commit is contained in:
+19
-1
@@ -37,7 +37,11 @@ func (m *Zones) scanDirectory(_ *ScanOptions) error {
|
||||
switch {
|
||||
case err != nil:
|
||||
return core.Wrap(err, e.Name())
|
||||
case z.Machines.Len() > 0:
|
||||
case z.Machines.Len() == 0:
|
||||
z.warn(nil).
|
||||
WithField("zone", z.Name).
|
||||
Print("empty")
|
||||
default:
|
||||
m.Zones = append(m.Zones, z)
|
||||
}
|
||||
}
|
||||
@@ -53,6 +57,10 @@ func (m *Zones) newZone(name string) (*Zone, error) {
|
||||
Name: name,
|
||||
}
|
||||
|
||||
z.debug().
|
||||
WithField("zone", z.Name).
|
||||
Print("found")
|
||||
|
||||
if err := z.scan(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -149,7 +157,17 @@ func (z *Zone) scan() error {
|
||||
Name: e.Name(),
|
||||
}
|
||||
|
||||
m.debug().
|
||||
WithField("node", m.Name).
|
||||
WithField("zone", z.Name).
|
||||
Print("found")
|
||||
|
||||
if err := m.init(); err != nil {
|
||||
m.error(err).
|
||||
WithField("node", m.Name).
|
||||
WithField("zone", z.Name).
|
||||
Print()
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user