fix panic on missing formatter in console_exporter.ProcessorOptions
This commit is contained in:
parent
d119563c7d
commit
c70a285e70
@ -11,6 +11,7 @@ import (
|
|||||||
"git.ma-al.com/maal-libraries/observer/pkg/attr/layer_attr"
|
"git.ma-al.com/maal-libraries/observer/pkg/attr/layer_attr"
|
||||||
"git.ma-al.com/maal-libraries/observer/pkg/event"
|
"git.ma-al.com/maal-libraries/observer/pkg/event"
|
||||||
"git.ma-al.com/maal-libraries/observer/pkg/exporters"
|
"git.ma-al.com/maal-libraries/observer/pkg/exporters"
|
||||||
|
"git.ma-al.com/maal-libraries/observer/pkg/exporters/console_exporter"
|
||||||
tracing "git.ma-al.com/maal-libraries/observer/pkg/fiber_tracing"
|
tracing "git.ma-al.com/maal-libraries/observer/pkg/fiber_tracing"
|
||||||
"git.ma-al.com/maal-libraries/observer/pkg/level"
|
"git.ma-al.com/maal-libraries/observer/pkg/level"
|
||||||
"github.com/gofiber/fiber/v2"
|
"github.com/gofiber/fiber/v2"
|
||||||
@ -22,7 +23,7 @@ func main() {
|
|||||||
main := fiber.New()
|
main := fiber.New()
|
||||||
|
|
||||||
exps := make([]exporters.TraceExporter, 0)
|
exps := make([]exporters.TraceExporter, 0)
|
||||||
exps = append(exps, exporters.DevConsoleExporter())
|
exps = append(exps, exporters.DevConsoleExporter(console_exporter.ProcessorOptions{}))
|
||||||
gelfExp, err := exporters.GelfExporter()
|
gelfExp, err := exporters.GelfExporter()
|
||||||
if err == nil {
|
if err == nil {
|
||||||
exps = append(exps, gelfExp)
|
exps = append(exps, gelfExp)
|
||||||
|
@ -76,7 +76,8 @@ func NewProcessor(opts ProcessorOptions) trace.SpanProcessor {
|
|||||||
if opts.TraceFormatter != nil {
|
if opts.TraceFormatter != nil {
|
||||||
formatter = *opts.TraceFormatter
|
formatter = *opts.TraceFormatter
|
||||||
} else {
|
} else {
|
||||||
formatter = TraceFormatter(nil)
|
fmt := NewPrettyMultilineFormatter()
|
||||||
|
formatter = fmt
|
||||||
}
|
}
|
||||||
if opts.FilterOnLevel != 0 {
|
if opts.FilterOnLevel != 0 {
|
||||||
lvl = opts.FilterOnLevel
|
lvl = opts.FilterOnLevel
|
||||||
|
Loading…
Reference in New Issue
Block a user