mirror of
https://github.com/MontFerret/ferret.git
synced 2025-11-06 08:39:09 +02:00
Bugfix/logging (#346)
* Fixed inability to pass custom ID to th runtime logger * Removed UUID module * Removed redundant check
This commit is contained in:
@@ -13,7 +13,7 @@ import (
|
||||
type (
|
||||
Options struct {
|
||||
params map[string]core.Value
|
||||
logging *logging.Options
|
||||
logging logging.Options
|
||||
}
|
||||
|
||||
Option func(*Options)
|
||||
@@ -22,7 +22,7 @@ type (
|
||||
func NewOptions(setters []Option) *Options {
|
||||
opts := &Options{
|
||||
params: make(map[string]core.Value),
|
||||
logging: &logging.Options{
|
||||
logging: logging.Options{
|
||||
Writer: os.Stdout,
|
||||
Level: logging.ErrorLevel,
|
||||
},
|
||||
@@ -61,6 +61,12 @@ func WithLogLevel(lvl logging.Level) Option {
|
||||
}
|
||||
}
|
||||
|
||||
func WithLogFields(fields map[string]interface{}) Option {
|
||||
return func(options *Options) {
|
||||
options.logging.Fields = fields
|
||||
}
|
||||
}
|
||||
|
||||
func (opts *Options) WithContext(parent context.Context) context.Context {
|
||||
ctx := core.ParamsWith(parent, opts.params)
|
||||
ctx = logging.WithContext(ctx, opts.logging)
|
||||
|
||||
Reference in New Issue
Block a user