add Name func option

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
2021-01-29 14:07:35 +03:00
parent 7af7649448
commit 125646d89b
8 changed files with 61 additions and 0 deletions

View File

@@ -11,6 +11,7 @@ type Option func(*Options)
// Options holds logger options
type Options struct {
Name string
// The logging level the logger should log at. default is `InfoLevel`
Level Level
// fields to always be logged
@@ -72,3 +73,10 @@ func WithContext(ctx context.Context) Option {
o.Context = ctx
}
}
// WithName sets the name
func withName(n string) Option {
return func(o *Options) {
o.Name = n
}
}