Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
2024-05-09 16:41:22 +03:00
parent 9c8fbb2202
commit 62074965ee
5 changed files with 35 additions and 12 deletions

View File

@@ -6,6 +6,8 @@ import (
"log/slog"
"os"
"time"
"go.unistack.org/micro/v3/meter"
)
// Option func signature
@@ -45,6 +47,8 @@ type Options struct {
Level Level
// TimeFunc used to obtain current time
TimeFunc func() time.Time
// Meter used to count logs for specific level
Meter meter.Meter
}
// NewOptions creates new options struct
@@ -58,6 +62,7 @@ func NewOptions(opts ...Option) Options {
ContextAttrFuncs: DefaultContextAttrFuncs,
AddSource: true,
TimeFunc: time.Now,
Meter: meter.DefaultMeter,
}
WithMicroKeys()(&options)