Commit 416a478c authored by xuzhonghu's avatar xuzhonghu

Add String method to audit.Backend interface

parent a00e3748
...@@ -39,4 +39,7 @@ type Backend interface { ...@@ -39,4 +39,7 @@ type Backend interface {
// events are delivered. It can be assumed that this method is called after // events are delivered. It can be assumed that this method is called after
// the stopCh channel passed to the Run method has been closed. // the stopCh channel passed to the Run method has been closed.
Shutdown() Shutdown()
// Returns the backend PluginName.
String() string
} }
...@@ -40,6 +40,10 @@ func (f *fakeBackend) Shutdown() { ...@@ -40,6 +40,10 @@ func (f *fakeBackend) Shutdown() {
// Nothing to do here. // Nothing to do here.
} }
func (f *fakeBackend) String() string {
return ""
}
func TestUnion(t *testing.T) { func TestUnion(t *testing.T) {
backends := []Backend{ backends := []Backend{
new(fakeBackend), new(fakeBackend),
......
...@@ -44,3 +44,7 @@ func (b *Backend) ProcessEvents(ev ...*auditinternal.Event) { ...@@ -44,3 +44,7 @@ func (b *Backend) ProcessEvents(ev ...*auditinternal.Event) {
b.OnRequest(ev) b.OnRequest(ev)
} }
} }
func (b *Backend) String() string {
return ""
}
...@@ -111,8 +111,14 @@ type auditSinkFunc func(events ...*auditinternal.Event) ...@@ -111,8 +111,14 @@ type auditSinkFunc func(events ...*auditinternal.Event)
func (f auditSinkFunc) ProcessEvents(events ...*auditinternal.Event) { func (f auditSinkFunc) ProcessEvents(events ...*auditinternal.Event) {
f(events...) f(events...)
} }
func (auditSinkFunc) Run(stopCh <-chan struct{}) error { func (auditSinkFunc) Run(stopCh <-chan struct{}) error {
return nil return nil
} }
func (auditSinkFunc) Shutdown() { func (auditSinkFunc) Shutdown() {
} }
func (auditSinkFunc) String() string {
return ""
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment