1
0
mirror of https://github.com/go-micro/go-micro.git synced 2025-01-05 10:20:53 +02:00
go-micro/plugins/logger/windowseventlog
Jerry 93ba8cd0df
continue fix pre version go get bug that unknown v3.5.1 (#2188)
* 1.fix plugins go get bug.
2.update all mode.
3.add tidy tools

* continue fix pre version go get bug that unknown v3.5.1
2021-06-30 09:24:00 +01:00
..
go.mod continue fix pre version go get bug that unknown v3.5.1 (#2188) 2021-06-30 09:24:00 +01:00
go.sum update etcd version (#2186) 2021-06-29 13:40:54 +01:00
options.go Windows event log plugin (#2180) 2021-06-20 09:28:30 +01:00
README.md Windows event log plugin (#2180) 2021-06-20 09:28:30 +01:00
windowseventlog_test.go Windows event log plugin (#2180) 2021-06-20 09:28:30 +01:00
windowseventlog.go Windows event log plugin (#2180) 2021-06-20 09:28:30 +01:00

WindowsEventLog

windows event log implementation for go-micro meta logger.

Usage

Before the first use, it is necessary to initialize the registrar with administrator rights.

The NewLogger function tries to create an event source named src in the options (or by default), but this may not happen, so for proper initialization it is recommended to use the Init function, which returns an error.

func Init() {
  l := windowseventlog.NewLogger(windowseventlog.WithSrc("test src"), logger.WithEid(1000))
  err := l.Init()
  if err != nil {
      //smt
  }
}
func Example() {
  logger.DefaultLogger = windowseventlog.NewLogger(windowseventlog.WithSrc("test src"), logger.WithEid(1000))

  logger.Infof(logger.InfoLevel, "testing: %s", "Infof")

}