// NewLoggingHook returns a new instance of LoggingHook for the given Cilium
// component.
761029
func NewLoggingHook(component string) *LoggingHook {
	// NOTE(mrostecki): For now errors and warning metric exists only for Cilium
	// daemon, but support of Prometheus metrics in some other components (i.e.
	// cilium-health - GH-4268) is planned.

	// Pick a metric for the component.
	var metric *prometheus.CounterVec
	switch component {
	case components.CiliumAgentName:
		metric = ErrorsWarnings
	default:
		panic(fmt.Sprintf("component %s is unsupported by LoggingHook", component))
	}

	return &LoggingHook{metric: metric}
}
742473
func (cl *CoLog) NewLogger() *log.Logger {
	cl.mu.Lock()
	defer cl.mu.Unlock()

	return log.New(cl, "", 0)
}
907742
func NewLogRequestEnd(TARGET_SYSTEM uint8, TARGET_COMPONENT uint8) *LogRequestEnd {
	m := LogRequestEnd{}
	m.TARGET_SYSTEM = TARGET_SYSTEM
	m.TARGET_COMPONENT = TARGET_COMPONENT
	return &m
}
379839
func NewNopLogger() Logger {
	l := logrus.New()
	l.Out = ioutil.Discard
	return logger{entry: logrus.NewEntry(l)}
}
126641
func (c *Client) NewLogger() (*Logger, error) {
	log := newLogger()
	log.client = c

	return log, nil
}
354339
func NewLogger(f *Fibre) *Logger {

	return &Logger{&logrus.Logger{
		Out:       os.Stderr,
		Level:     logrus.ErrorLevel,
		Hooks:     make(logrus.LevelHooks),
		Formatter: new(logrus.TextFormatter),
	}}

}
426427
func NewLogger(handler Handler) *Logger {
	return &Logger{
		Handler:      handler,
		EnableSource: true,
		EnableDebug:  true,
	}
}
1117299
func (s *WriteApplicationSettingsRequest) SetCampaignHook(v *CampaignHook) *WriteApplicationSettingsRequest {
	s.CampaignHook = v
	return s
}
170426
func (cl *CoLog) AddHook(hook Hook) {
	cl.mu.Lock()
	defer cl.mu.Unlock()

	for _, l := range hook.Levels() {
		cl.hooks[l] = append(cl.hooks[l], hook)
	}
}
77990
func NewAsyncSentryHook(DSN string, levels []logrus.Level) (*SentryHook, error) {
	hook, err := NewSentryHook(DSN, levels)
	return setAsync(hook), err
}
880157
func NewHook(token string, env string, opts ...OptionFunc) *Hook {
	h := NewHookForLevels(token, env, defaultTriggerLevels)

	for _, o := range opts {
		o(h)
	}

	return h
}
23483
func NewLogger() dlog.Logger {
	return dlog.NewLogger(
		glog.Infoln,
		map[dlog.Level]func(...interface{}){
			dlog.LevelDebug: glog.Infoln,
			dlog.LevelInfo:  glog.Infoln,
			dlog.LevelWarn:  glog.Warningln,
			dlog.LevelError: glog.Errorln,
			// this relies on implementation-specific details of the generic dlog Logger implementation, not good
			dlog.LevelFatal: glog.Fatalln,
			dlog.LevelPanic: glog.Errorln,
		},
	)
}
1221203
func (c Capabilities) AddLogging(l log.Capabilities) {
	c[log.CapabilitiesKey] = l
}
827559
func (a *Attachments) CommitHook(hi hook.Info) error {
	storageState, err := a.storageStateForHook(hi)
	if err != nil {
		return errors.Trace(err)
	}
	if err := storageState.CommitHook(hi); err != nil {
		return err
	}
	storageTag := names.NewStorageTag(hi.StorageId)
	switch hi.Kind {
	case hooks.StorageAttached:
		a.pending.Remove(storageTag)
	case hooks.StorageDetaching:
		if err := a.removeStorageAttachment(storageTag); err != nil {
			return errors.Trace(err)
		}
	}
	return nil
}
1051827
func newHook(source, hook io.Reader) io.Reader {
	if hook == nil {
		return source
	}
	return &hookReader{source, hook}
}
1079341
func NewWithConfig(conf Config) (*FluentHook, error) {
	var fd *fluent.Fluent
	if !conf.DisableConnectionPool {
		var err error
		fd, err = fluent.New(conf.FluentConfig())
		if err != nil {
			return nil, err
		}
	}

	hook := &FluentHook{
		Fluent:       fd,
		conf:         conf,
		levels:       conf.LogLevels,
		ignoreFields: make(map[string]struct{}),
		filters:      make(map[string]func(interface{}) interface{}),
	}
	// set default values
	if len(hook.levels) == 0 {
		hook.levels = defaultLevels
	}
	if conf.DefaultTag != "" {
		tag := conf.DefaultTag
		hook.tag = &tag
	}
	if conf.DefaultMessageField != "" {
		hook.messageField = conf.DefaultMessageField
	}
	for k, v := range conf.DefaultIgnoreFields {
		hook.ignoreFields[k] = v
	}
	for k, v := range conf.DefaultFilters {
		hook.filters[k] = v
	}

	return hook, nil
}
168009
func (s *Server) RegisterEOFHook(h EOFHook) error {
	return s.xp.dispatcher.RegisterEOFHook(h)
}