// newManager can be used to instantiate configManager
// Users of this function are expected to manage the execution via context
// github.com/sirupsen/logrus package is used for logging internally
171406
func newManager(kv kvdb.Kvdb) (*configManager, error) {
	manager := new(configManager)

	manager.cbCluster = make(map[string]CallbackClusterConfigFunc)
	manager.cbNode = make(map[string]CallbackNodeConfigFunc)

	// kvdb pointer
	manager.kv = kv

	// register function with kvdb to watch cluster level changes
	if err := kv.WatchTree(filepath.Join(baseKey, clusterKey), 0,
		&dataToKvdb{Type: clusterWatcher}, manager.kvdbCallback); err != nil {
		logrus.Error(err)
		return nil, err
	}
	if err := kv.WatchTree(filepath.Join(baseKey, nodeKey), 0,
		&dataToKvdb{Type: nodeWatcher}, manager.kvdbCallback); err != nil {
		logrus.Error(err)
		return nil, err
	}

	return manager, nil
}
67934
func (kern *Kernel) LoadLoggerFromConfig(conf *logconfig.LoggingConfig) error {
	logger, err := lifecycle.NewLoggerFromLoggingConfig(conf)
	kern.SetLogger(logger)
	return err
}
1126865
func NewManager(routers map[string]*config.Router,
	serviceManager *service.Manager, middlewaresBuilder *middleware.Builder, modifierBuilder *responsemodifiers.Builder,
) *Manager {
	return &Manager{
		routerHandlers:     make(map[string]http.Handler),
		configs:            routers,
		serviceManager:     serviceManager,
		middlewaresBuilder: middlewaresBuilder,
		modifierBuilder:    modifierBuilder,
	}
}
587181
func NewManager(config tokenManagerConfiguration) (Manager, error) {
	// Load public keys from Auth service and add them to the manager
	tm := &tokenManager{
		publicKeysMap: map[string]*rsa.PublicKey{},
	}

	keysEndpoint := fmt.Sprintf("%s%s", config.GetAuthServiceURL(), authservice.KeysTokenPath())
	remoteKeys, err := authjwk.FetchKeys(keysEndpoint)
	if err != nil {
		log.Error(nil, map[string]interface{}{
			"err":      err,
			"keys_url": keysEndpoint,
		}, "unable to load public keys from remote service")
		return nil, errors.New("unable to load public keys from remote service")
	}
	for _, remoteKey := range remoteKeys {
		tm.publicKeysMap[remoteKey.KeyID] = remoteKey.Key
		tm.publicKeys = append(tm.publicKeys, &PublicKey{KeyID: remoteKey.KeyID, Key: remoteKey.Key})
		log.Info(nil, map[string]interface{}{
			"kid": remoteKey.KeyID,
		}, "Public key added")
	}

	devModeURL := config.GetKeycloakDevModeURL()
	if devModeURL != "" {
		remoteKeys, err = authjwk.FetchKeys(fmt.Sprintf("%s/protocol/openid-connect/certs", devModeURL))
		if err != nil {
			log.Error(nil, map[string]interface{}{
				"err":      err,
				"keys_url": devModeURL,
			}, "unable to load public keys from remote service in Dev Mode")
			return nil, errors.New("unable to load public keys from remote service in Dev Mode")
		}
		for _, remoteKey := range remoteKeys {
			tm.publicKeysMap[remoteKey.KeyID] = remoteKey.Key
			tm.publicKeys = append(tm.publicKeys, &PublicKey{KeyID: remoteKey.KeyID, Key: remoteKey.Key})
			log.Info(nil, map[string]interface{}{
				"kid": remoteKey.KeyID,
			}, "Public key added")
		}
		// Add the public key which will be used to verify tokens generated in dev mode
		rsaKey, err := jwt.ParseRSAPrivateKeyFromPEM([]byte(configuration.DevModeRsaPrivateKey))
		if err != nil {
			return nil, err
		}
		tm.publicKeysMap["test-key"] = &rsaKey.PublicKey
		tm.publicKeys = append(tm.publicKeys, &PublicKey{KeyID: "test-key", Key: &rsaKey.PublicKey})
		log.Info(nil, map[string]interface{}{
			"kid": "test-key",
		}, "Public key added")
	}

	return tm, nil
}
805878
func NewManager() *Manager {
	return &Manager{
		plugins:       make(plugins),
		closers:       make(map[string]chan<- struct{}),
		subscriptions: make(map[Event]plugins),
		selects:       make([]reflect.SelectCase, 0, 16),
		handler:       make(mapMuxr),
	}
}
673218
func (b *Builder) Logger(logger log.Logger) *Builder {
	b.logger = logger
	return b
}
205852
func (reporterOptions) Logger(logger Logger) ReporterOption {
	return func(r *reporterOptions) {
		r.logger = logger
	}
}
1144770
func NewManager(c *cdp.Client) (*Manager, error) {
	m := &Manager{
		c:    c,
		sC:   make(chan *session),
		errC: make(chan error, 1),
	}

	// TODO(mafredri): Inherit the context from rpcc.Conn in cdp.Client.
	// cdp.Client does not yet expose the context, nor rpcc.Conn.
	m.ctx, m.cancel = context.WithCancel(context.TODO())

	ev, err := newSessionEvents(m.ctx, c)
	if err != nil {
		close(m.errC)
		m.Close()
		return nil, err
	}

	m.done = make(chan error, 1)
	go m.watch(ev, m.sC, m.done, m.errC)
	return m, nil
}
873819
func NewLogoManager(r *http.Request) *LogoManager {
	session := db.GetDBSession(r)
	return &LogoManager{
		session:    session,
		collection: getLogoCollection(session),
	}
}
1029000
func NewManager() Manager {
	return &manager{
		cache:   make(map[kubecontainer.ContainerID]Result),
		updates: make(chan Update, 20),
	}
}
1174901
func NewManager(r *http.Request) *Manager {
	session := db.GetDBSession(r)
	return &Manager{
		session:         session,
		collection:      getPasswordCollection(session),
		tokencollection: getPasswordResetTokenCollection(session),
	}
}
932227
func (s *Logging) Logger(name string) *FabricLogger {
	zl := s.ZapLogger(name)
	return NewFabricLogger(zl)
}
673954
func NewManager(r *http.Request) *Manager {
	session := db.GetDBSession(r)
	return &Manager{
		session:    session,
		collection: getTotpCollection(session),
	}
}
357457
func NewManager() *Manager {
	session := db.GetSession()
	return &Manager{
		session:    session,
		collection: getConfigCollection(session),
	}
}
466525
func Logger(l log.Logger) Option {
	return func(r *Ringpop) error {
		logging.SetLogger(l)
		return nil
	}
}
1170148
func NewConfigurator(config Config, logger *log.Logger) (*Configurator, error) {
	c := &Configurator{logger: logger}
	err := c.Update(config)
	if err != nil {
		return nil, err
	}
	return c, nil
}
1328112
func CreateLogger(args ...interface{}) (Logger, error) {
	config := Config{}
	logger := Logger{}
	r := regexp.MustCompile(`bunyan.Config$`)

	if len(args) == 0 {
		return logger, fmt.Errorf("Create logger requires either a bunyan.Config or String argument")
	}

	// get hostname
	if hostname, err := os.Hostname(); err != nil {
		return logger, err
	} else {
		logger.hostname = hostname
	}

	arg := args[0]
	argType := typeName(arg)

	if argType == "string" {
		config.Name = arg.(string)
	} else if r.MatchString(argType) {
		config = arg.(Config)
		if config.Name == "" {
			return logger, fmt.Errorf("Bunyan Config requires a name, none specified")
		}
	} else {
		return logger, fmt.Errorf("Create logger requires either a bunyan.Config or String argument")
	}

	// add the config to the logger
	logger.config = config
	logger.staticFields = config.StaticFields
	logger.serializers = config.Serializers

	// add the streams
	if len(config.Streams) != 0 {
		for _, stream := range config.Streams {
			logger.AddStream(stream)
		}
	} else if config.Stream != nil {
		simpleStream := Stream{Stream: config.Stream, Name: config.Name}
		logger.AddStream(simpleStream)
	}

	return logger, nil
}