renamed DiscardRouter to DiscardingRouter.

master
Charles Iliya Krempeaux 2015-10-10 14:21:25 -07:00
parent d8c0295605
commit 5c15d262cf
6 changed files with 16 additions and 16 deletions

View File

@ -15,7 +15,7 @@ func TestNewCopyingRouter(t *testing.T) {
randomness := rand.New(rand.NewSource( time.Now().UTC().UnixNano() ))
router := NewCopyingRouter(NewDiscardRouter())
router := NewCopyingRouter(NewDiscardingRouter())
if nil == router {
t.Errorf("After trying to create a copying router, expected it to be not nil, but was: %v", router)
}
@ -94,7 +94,7 @@ func TestCopyingRouterRoute(t *testing.T) {
TLoop: for testNumber, test := range tests {
router := NewCopyingRouter(NewDiscardRouter())
router := NewCopyingRouter(NewDiscardingRouter())
for _, datum := range test.Data {
router.Route(datum.Message, datum.Context)

View File

@ -2,23 +2,23 @@ package flog
var (
singltonDiscardRouter = DiscardRouter{}
singltonDiscardingRouter = DiscardingRouter{}
)
// NewDiscardRouter returns an initialized DiscardRouter.
func NewDiscardRouter() *DiscardRouter {
return &singltonDiscardRouter
// NewDiscardingRouter returns an initialized DiscardingRouter.
func NewDiscardingRouter() *DiscardingRouter {
return &singltonDiscardingRouter
}
// DiscardRouter is a Router that discards any message (and its context)
// DiscardingRouter is a Router that discards any message (and its context)
// it is asked to route.
//
// Conceptually it is similar to /dev/null
type DiscardRouter struct{}
type DiscardingRouter struct{}
func (router *DiscardRouter) Route(message string, context map[string]interface{}) error {
func (router *DiscardingRouter) Route(message string, context map[string]interface{}) error {
return nil
}

View File

@ -10,12 +10,12 @@ import (
)
func TestNewDiscardRouter(t *testing.T) {
func TestNewDiscardingRouter(t *testing.T) {
randomness := rand.New(rand.NewSource( time.Now().UTC().UnixNano() ))
router := NewDiscardRouter()
router := NewDiscardingRouter()
if nil == router {
t.Errorf("After trying to create a discard router, expected it to be not nil, but was: %v", router)
}

View File

@ -15,7 +15,7 @@ func TestFilteringRouterJustCreated(t *testing.T) {
randomness := rand.New(rand.NewSource( time.Now().UTC().UnixNano() ))
router := NewFilteringRouter(NewDiscardRouter(), func(string, map[string]interface{}) bool {
router := NewFilteringRouter(NewDiscardingRouter(), func(string, map[string]interface{}) bool {
return false
})
if nil == router {
@ -44,7 +44,7 @@ func TestFilteringRouterJustFilterParameters(t *testing.T) {
var filterContext map[string] interface{}
var filterResult = false
router := NewFilteringRouter(NewDiscardRouter(), func(message string, context map[string]interface{}) bool {
router := NewFilteringRouter(NewDiscardingRouter(), func(message string, context map[string]interface{}) bool {
filterMessage = message
filterContext = context

View File

@ -8,7 +8,7 @@ import (
func TestNew(t *testing.T) {
flogger := New(NewDiscardRouter())
flogger := New(NewDiscardingRouter())
if nil == flogger {
t.Errorf("Expected created flogger to not be nil, but was: %v", flogger)
}
@ -155,7 +155,7 @@ func TestNewForContext(t *testing.T) {
TestLoop:
for testNumber, test := range tests {
flogger := New(NewDiscardRouter(), test.Cascade...)
flogger := New(NewDiscardingRouter(), test.Cascade...)
context := flogger.(*internalFlogger).context

View File

@ -303,7 +303,7 @@ func TestWith(t *testing.T) {
TestLoop:
for testNumber, test := range tests {
flogger1 := New(NewDiscardRouter(), test.Cascade1...)
flogger1 := New(NewDiscardingRouter(), test.Cascade1...)
flogger2 := flogger1.With(test.Cascade2...)