mirror of
https://github.com/offen/docker-volume-backup.git
synced 2024-11-22 21:30:28 +01:00
Improve logging
This commit is contained in:
parent
7d489a95e3
commit
87ea8d0930
@ -170,16 +170,27 @@ func (s *script) stopContainersAndServices() (func() error, error) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
s.logger.Info(
|
if isDockerSwarm {
|
||||||
fmt.Sprintf(
|
s.logger.Info(
|
||||||
"Stopping %d out of %d running container(s) and scaling down %d out of %d active service(s) as they were labeled %s.",
|
fmt.Sprintf(
|
||||||
len(containersToStop),
|
"Stopping %d out of %d running container(s) and scaling down %d out of %d active service(s) as they were labeled %s.",
|
||||||
len(allContainers),
|
len(containersToStop),
|
||||||
len(servicesToScaleDown),
|
len(allContainers),
|
||||||
len(allServices),
|
len(servicesToScaleDown),
|
||||||
filterMatchLabel,
|
len(allServices),
|
||||||
),
|
filterMatchLabel,
|
||||||
)
|
),
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
s.logger.Info(
|
||||||
|
fmt.Sprintf(
|
||||||
|
"Stopping %d out of %d running container(s) as they were labeled %s.",
|
||||||
|
len(containersToStop),
|
||||||
|
len(allContainers),
|
||||||
|
filterMatchLabel,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
var stoppedContainers []types.Container
|
var stoppedContainers []types.Container
|
||||||
var stopErrors []error
|
var stopErrors []error
|
||||||
@ -309,13 +320,23 @@ func (s *script) stopContainersAndServices() (func() error, error) {
|
|||||||
errors.Join(allErrors...),
|
errors.Join(allErrors...),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
s.logger.Info(
|
if isDockerSwarm {
|
||||||
fmt.Sprintf(
|
s.logger.Info(
|
||||||
"Restarted %d container(s) and %d service(s).",
|
fmt.Sprintf(
|
||||||
len(stoppedContainers),
|
"Restarted %d container(s) and %d service(s).",
|
||||||
len(scaledDownServices),
|
len(stoppedContainers),
|
||||||
),
|
len(scaledDownServices),
|
||||||
)
|
),
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
s.logger.Info(
|
||||||
|
fmt.Sprintf(
|
||||||
|
"Restarted %d container(s).",
|
||||||
|
len(stoppedContainers),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}, initialErr
|
}, initialErr
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user