Skip to content

Logger.WithValues() produces SEGV. #4

@jortel

Description

@jortel

logger.WithValues() returns logger with Sink having a nil logger.

log = log.WithValues(
                "duration",
                settings.Duration,
                "kind",
                settings.Kind,
                "path",
                Settings.Path)

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x951537]

goroutine 1 [running]:
github.com/sirupsen/logrus.(*Logger).newEntry(0x0)
        /home/jortel/go/pkg/mod/github.com/sirupsen/logrus@v1.9.0/logger.go:99 +0x17
github.com/sirupsen/logrus.(*Logger).WithFields(0x0, 0xc0007bea80)
        /home/jortel/go/pkg/mod/github.com/sirupsen/logrus@v1.9.0/logger.go:124 +0x36
github.com/jortel/go-utils/logr.(*Sink).Info(0xc0007beab0, 0x1a2d5c0?, {0x1bb458a, 0x11}, {0x0?, 0x958dbd?, 0xc000153740?})
        /home/jortel/go/pkg/mod/github.com/jortel/go-utils@v0.1.2/logr/logger.go:74 +0x53
github.com/go-logr/logr.Logger.Info({{0x1e8cb28?, 0xc0007beab0?}, 0x9581b2?}, {0x1bb458a, 0x11}, {0x0, 0x0, 0x0})
        /home/jortel/go/pkg/mod/github.com/go-logr/logr@v1.2.4/logr.go:278 +0xf3
main.profiler()
        /home/jortel/go/src/github.com/konveyor/tackle2-hub/cmd/main.go:244 +0x353
main.main()
        /home/jortel/go/src/github.com/konveyor/tackle2-hub/cmd/main.go:102 +0x12a

Process finished with the exit code 2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions