Skip to content

feat(audit): route tunnel-api and convert through the audit logger #884

Description

@Tamar-Dinavetsky

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

kind/bugCategorizes issue or PR as related to a bug.

Type

No type

Projects

Relationships

None yet

Development

No branches or pull requests

Issue actions