mirror of
https://github.com/eosswedenorg/thalos
synced 2026-06-19 04:50:02 +02:00
internal/log/RotatingFileOptions.go: adding implementation for the functional option pattern.
This commit is contained in:
parent
cd54b770a5
commit
bcdaa9cea4
1 changed files with 17 additions and 0 deletions
17
internal/log/RotatingFileOptions.go
Normal file
17
internal/log/RotatingFileOptions.go
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
package log
|
||||||
|
|
||||||
|
import "time"
|
||||||
|
|
||||||
|
type RotatingFileOption func(*RotatingFile)
|
||||||
|
|
||||||
|
func WithMaxSize(value int64) RotatingFileOption {
|
||||||
|
return func(f *RotatingFile) {
|
||||||
|
f.maxSize = value
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func WithMaxAge(value time.Duration) RotatingFileOption {
|
||||||
|
return func(f *RotatingFile) {
|
||||||
|
f.maxAge = value
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue