ong icon indicating copy to clipboard operation
ong copied to clipboard

ong/log: make maxSize configurable at runtime

Open komuw opened this issue 1 year ago • 0 comments

https://github.com/komuw/ong/blob/ca6f5d216e6f974d33976c8b37bd4c20f4273d39/log/log.go#L52

This would allow people to increase/decrease the size of log buffer at runtime. Imagine if your app is getting lots of errors and you want to include longer duration context. Right now you would have to re-deploy with a bigger maxSize, with this proposal; you could just dynamically set it.

We just need to make maxSize be a type that is based off atomic.Int64, similar to slog.LevelVar; https://github.com/golang/go/blob/go1.22.2/src/log/slog/level.go#L152-L160
https://github.com/FiloSottile/sunlight/blob/dd12c8afecd6e57d9f6d70abf4d121e52f4f3d8b/cmd/sunlight/main.go#L199-L215

Also see; https://github.com/komuw/ong/issues/423

komuw avatar Apr 04 '24 20:04 komuw