github.com/moleculer-go/moleculer@v0.3.3/transit/common_test.go (about)

     1  package transit_test
     2  
     3  import (
     4  	. "github.com/moleculer-go/goemitter"
     5  	"github.com/moleculer-go/moleculer"
     6  
     7  	"github.com/moleculer-go/moleculer/registry"
     8  	log "github.com/sirupsen/logrus"
     9  )
    10  
    11  var logger = log.WithField("unit test pkg", "transit_test")
    12  
    13  func CreateLogger(name string, value string) *log.Entry {
    14  	return logger.WithField(name, value)
    15  }
    16  
    17  var localNode = registry.CreateNode("unit-test-node", true, logger)
    18  
    19  func BrokerDelegates() *moleculer.BrokerDelegates {
    20  	localBus := Construct()
    21  	broker := &moleculer.BrokerDelegates{
    22  		LocalNode: func() moleculer.Node {
    23  			return localNode
    24  		},
    25  		Logger: CreateLogger,
    26  		Bus: func() *Emitter {
    27  			return localBus
    28  		}}
    29  	return broker
    30  }