feat: improve 'logger' field from logger

This commit is contained in:
Julien Neuhart
2021-12-08 15:41:08 +01:00
parent 8b8a02b68c
commit f376cd5ab1
3 changed files with 12 additions and 5 deletions

View File

@@ -31,7 +31,7 @@ func Command(logger *zap.Logger, binPath string, args ...string) Cmd {
return Cmd{
ctx: nil,
logger: logger.Named("cmd"),
logger: logger.Named(strings.ReplaceAll(binPath, "/", "")),
process: cmd,
}
}
@@ -51,7 +51,7 @@ func CommandContext(ctx context.Context, logger *zap.Logger, binPath string, arg
return Cmd{
ctx: ctx,
logger: logger.Named("cmd"),
logger: logger.Named(strings.ReplaceAll(binPath, "/", "")),
process: cmd,
}, nil
}