logger

command module
v0.0.0-...-8655829 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 11, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

README

logger

this is a logger that extends slog with a logger name and add stack traces on error

example

l := log.NewLogger(&log.HandlerOptions{Name: "wire-controller", AddSource: false})
l = l.WithGroup("group").With("k11", "v11", "k12", "v12")
l.Info("test",
		"k1", "v1")

l.Info("")

output

{
  "time": "2023-09-11T04:38:19.23852-05:00",
  "level": "INFO",
  "message": "test",
  "logger": "wire-controller",
  "data": {
    "group": {
      "k11": "v11",
      "k12": "v12",
      "k1": "v1"
    }
  }
}
{
  "time": "2023-09-11T04:38:19.238526-05:00",
  "level": "INFO",
  "message": "",
  "logger": "wire-controller",
  "data": {
    "group": {
      "k11": "v11",
      "k12": "v12"
    }
  }
}

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL