What did you expect to happen?
crane tunnel-api and crane convert logs should appear in the persistent audit log file (audit/.crane-audit.log) introduced in #883 (comment).
What actually happened?
Both commands create their own logrus.New() logger internally and do not receive *flags.GlobalFlags, so their log output bypasses GetLogger() and the audit hooks entirely. Their logs go only to stderr/stdout and never reach the audit file.
Additionally, tunnel-api uses the stdlib log.Fatal in several places which cannot be redirected through logrus at all.
Proposed fix :
- Add f
*flags.GlobalFlags parameter to NewTunnelAPIOptions and NewConvertOptions
- Replace internal
logrus.New() with f.GetLoggerOrDefault()
- Replace
log.Fatal(err, msg) in tunnel-api with logger.Fatalf("%s: %v", msg, err)
- Update main.go to pass f to both constructors
- Call
f.SetCmdName("tunnel-api") / f.SetCmdName("convert") before logging
What did you expect to happen?
crane tunnel-api and crane convert logs should appear in the persistent audit log file (audit/.crane-audit.log) introduced in #883 (comment).
What actually happened?
Both commands create their own logrus.New() logger internally and do not receive
*flags.GlobalFlags, so their log output bypassesGetLogger()and the audit hooks entirely. Their logs go only to stderr/stdout and never reach the audit file.Additionally, tunnel-api uses the stdlib
log.Fatalin several places which cannot be redirected through logrus at all.Proposed fix :
*flags.GlobalFlagsparameter toNewTunnelAPIOptionsandNewConvertOptionslogrus.New()withf.GetLoggerOrDefault()log.Fatal(err, msg)in tunnel-api withlogger.Fatalf("%s: %v", msg, err)f.SetCmdName("tunnel-api")/f.SetCmdName("convert")before logging