Skip to content

Commit ddd4664

Browse files
committed
chore: improve logging
Signed-off-by: Marco Nenciarini <[email protected]>
1 parent b9c3900 commit ddd4664

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

internal/cnpgi/common/wal.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,11 +88,14 @@ func (w WALServiceImplementation) Archive(
8888
ctx context.Context,
8989
request *wal.WALArchiveRequest,
9090
) (*wal.WALArchiveResult, error) {
91-
contextLogger := log.FromContext(ctx)
92-
contextLogger.Debug("starting wal archive")
93-
9491
baseWalName := path.Base(request.GetSourceFileName())
9592

93+
contextLogger := log.FromContext(ctx)
94+
contextLogger.Debug("wal archive start", "walName", baseWalName)
95+
defer func() {
96+
contextLogger.Debug("wal archive end", "walName", baseWalName)
97+
}()
98+
9699
// Step 1: parse the configuration and get the environment variables needed
97100
// for barman-cloud-wal-archive
98101
configuration, err := config.NewFromClusterJSON(request.ClusterDefinition)
@@ -115,6 +118,7 @@ func (w WALServiceImplementation) Archive(
115118
)
116119
if err != nil {
117120
if apierrors.IsForbidden(err) {
121+
contextLogger.Info(ErrMissingPermissions.Error())
118122
return nil, ErrMissingPermissions
119123
}
120124
return nil, err

0 commit comments

Comments
 (0)