github.com/v2pro/plz@v0.0.0-20221028024117-e5f9aec5b631/countlog/spi/func.go (about)

     1  package spi
     2  
     3  type FuncEventSink func(site *LogSite) EventHandler
     4  
     5  func (sink FuncEventSink) HandlerOf(site *LogSite) EventHandler {
     6  	return sink(site)
     7  }
     8  
     9  type FuncEventHandler func(event *Event)
    10  
    11  func (handler FuncEventHandler) Handle(event *Event) {
    12  	handler(event)
    13  }
    14  
    15  func (handler FuncEventHandler) LogSite() *LogSite {
    16  	return nil
    17  }