danielgtaylor / danielgtaylor/huma

humacli logging on stderr per default

Open
#809 5 comments 0 reactions 0 assignees View on GitHub
question
Dominant language
Go
Stars
4.4k
Forks
285
Avg merge
40m
Merged PRs (30d)
1

Description

Currently the humacli Shutdown hook logs on `os.Stderr` per default: https://github.com/danielgtaylor/huma/blob/6bfeebae55ed05e1e909041c5e3692dc168cd066/humacli/humacli.go#L301

This kind of breaks our logging setup where we use structured JSON logging. I don't really see a benefit in letting the library log this, clients can easily do this themselves:

```go
hooks.OnStop(func() {
logger.Info("Stopping server")

ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
defer cancel()

if err := server.Shutdown(ctx); err != nil {
logger.Error("Error shutting down server", slog.String("error", err.Error()))
}
})
```

Would you be open to an MR for removing the `fmt.Fprintln`, or replacing it with a logging interface? I'd be happy to provide a PR.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.