added docs

master
Charles Iliya Krempeaux 2015-10-10 02:43:53 -07:00
parent 73c5e4bfaf
commit 5c25e91116
1 changed files with 7 additions and 0 deletions

View File

@ -1,6 +1,12 @@
package flog package flog
// NewFilteredRouter returns an initialized FilteredRouter.
//
// 'subrouter' is the sub-router that a FilteredRouter will
// re-Route a 'message' (and 'context') to, but only on the
// condition that 'filterFn' returns 'true' for the 'message'
// and 'context' passed to it.
func NewFilteredRouter(subrouter Router, filterFn func(string, map[string]interface{})bool) *FilteredRouter { func NewFilteredRouter(subrouter Router, filterFn func(string, map[string]interface{})bool) *FilteredRouter {
router := FilteredRouter{ router := FilteredRouter{
subrouter:subrouter, subrouter:subrouter,
@ -11,6 +17,7 @@ func NewFilteredRouter(subrouter Router, filterFn func(string, map[string]interf
} }
// FilteredRouter is a Router that conditionally routes or discards a message (and its context).
type FilteredRouter struct { type FilteredRouter struct {
subrouter Router subrouter Router
filterFn func(string, map[string]interface{})bool filterFn func(string, map[string]interface{})bool