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,6 +170,7 @@ func (s *script) stopContainersAndServices() (func() error, error) {
|
||||
}
|
||||
}
|
||||
|
||||
if isDockerSwarm {
|
||||
s.logger.Info(
|
||||
fmt.Sprintf(
|
||||
"Stopping %d out of %d running container(s) and scaling down %d out of %d active service(s) as they were labeled %s.",
|
||||
@ -180,6 +181,16 @@ func (s *script) stopContainersAndServices() (func() error, error) {
|
||||
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 stopErrors []error
|
||||
@ -309,6 +320,7 @@ func (s *script) stopContainersAndServices() (func() error, error) {
|
||||
errors.Join(allErrors...),
|
||||
)
|
||||
}
|
||||
if isDockerSwarm {
|
||||
s.logger.Info(
|
||||
fmt.Sprintf(
|
||||
"Restarted %d container(s) and %d service(s).",
|
||||
@ -316,6 +328,15 @@ func (s *script) stopContainersAndServices() (func() error, error) {
|
||||
len(scaledDownServices),
|
||||
),
|
||||
)
|
||||
} else {
|
||||
s.logger.Info(
|
||||
fmt.Sprintf(
|
||||
"Restarted %d container(s).",
|
||||
len(stoppedContainers),
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
return nil
|
||||
}, initialErr
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user