// NewLogger returns a new TestLogger that can be used with the HaveLogged matcher.
// The returned logger uses log level lager.DEBUG.
163529
func NewLogger(component string) *TestLogger {
	buf := gbytes.NewBuffer()
	log := lager.NewLogger(component)
	log.RegisterSink(lager.NewWriterSink(buf, lager.DEBUG))
	return &TestLogger{log, buf}
}
35883
func NewFileLogger(filename string, time, debug, trace, pid bool) *Logger {
	fileflags := os.O_WRONLY | os.O_APPEND | os.O_CREATE
	f, err := os.OpenFile(filename, fileflags, 0660)
	if err != nil {
		log.Fatalf("error opening file: %v", err)
	}

	flags := 0
	if time {
		flags = log.LstdFlags | log.Lmicroseconds
	}

	pre := ""
	if pid {
		pre = pidPrefix()
	}

	l := &Logger{
		logger:  log.New(f, pre, flags),
		debug:   debug,
		trace:   trace,
		logFile: f,
	}

	setPlainLabelFormats(l)
	return l
}
58776
func New(l *log.Logger, ll Level) Logger {
	return &logger{
		Logger:   l,
		Level:    ll,
		ctxPairs: []interface{}{},
	}
}
810616
func NewLogger(config Config) (Logger, error) {
	switch config.Name {
	case Console:
		return NewConsoleLogger(config)
	case Syslog:
		return NewSysLogger(config)
	case UDPLog:
		return NewUDPLogger(config)
	}
	return nil, fmt.Errorf("unknown logger: %v", config)
}
71157
func NewLogger(p Priority, facility, tag string) (Syslogger, error) {
	fPriority, err := facilityPriority(facility)
	if err != nil {
		return nil, err
	}
	priority := syslog.Priority(p) | fPriority
	l, err := newBuiltin(priority, tag)
	if err != nil {
		return nil, err
	}
	return &builtinLogger{l}, nil
}
392424
func New(out io.Writer, threshold log.Level) *Logger {
	return &Logger{
		out:       out,
		threshold: threshold,
		Formatter: defaultFormater,
		Writer:    defaultWriter,
	}
}
16971
func NewPlainLogger(name string, l LevelInfo) (Sender, error) {
	return setup(MakePlainLogger(), name, l)
}
927819
func NewLogger(token string, opt LoggerOptions) (instance *LoggerType, err error) {
	opt.check()
	client := slack.New(token)
	if _, err = client.AuthTest(); err != nil {
		err = ErrSlackAuthTestFailed.New(err)
		return
	}

	ctx, cancel := context.WithCancel(opt.Context)
	eg, ctx := errgroup.WithContext(ctx)
	opt.Context = ctx

	logger := &LoggerType{
		token:        token,
		options:      opt,
		client:       client,
		messageQueue: make(chan messageType, opt.MessageQueueSize),
		eg:           eg,
		cancel:       cancel,
	}

	if !opt.Sync {
		for i := 0; i < opt.Worker; i++ {
			eg.Go(func() error {
				logger.workerLoop()
				return nil
			})
		}
	}

	return logger, nil
}
451973
func NewLogger(channellen int64, stealLevel ...int) *BeeLogger {
	bl := new(BeeLogger)
	bl.level = LevelDebug
	bl.loggerFuncCallDepth = 2
	bl.msg = make(chan *logMsg, channellen)
	bl.outputs = make(map[string]LoggerInterface)
	bl.status = WORK
	bl.steal = make(chan *logMsg, channellen)
	if len(stealLevel) > 0 {
		bl.stealLevelPreset = stealLevel[0]
	} else {
		bl.stealLevelPreset = LevelNothing
	}
	return bl
}
673218
func (b *Builder) Logger(logger log.Logger) *Builder {
	b.logger = logger
	return b
}
58273
func NewLogger(p Priority, logFlag int) (*log.Logger, error) {
	s, err := New(p, "")
	if err != nil {
		return nil, err
	}
	return log.New(s, "", logFlag), nil
}
414116
func NewLogger(stdout, stderr io.Writer, debug bool) *Logger {
	return &Logger{stdout: stdout, stderr: stderr, debug: debug}
}
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,
		},
	)
}
1064401
func NewJSONLogger(cfg *LogConfig, writer io.Writer) *JSONLogger {
	l := &JSONLogger{json.NewEncoder(writer), cfg}
	if l.cfg == nil {
		l.cfg = &LogConfig{}
	}
	return l
}
738655
func NewLogger(w io.Writer, newLogger func(io.Writer) log.Logger, color func(keyvals ...interface{}) FgBgColor) log.Logger {
	if !IsTerminal(w) {
		return newLogger(w)
	}
	return NewColorLogger(NewColorWriter(w), newLogger, color)
}
1209729
func NewLogger(prefix string, flags int, handler events.Handler) *log.Logger {
	return log.New(NewWriter(prefix, flags, handler), prefix, flags)
}
729295
func NewLogger() *Logger {
	l := &Logger{}
	l.base.SetPrefix("")
	l.base.SetFlags(log.Lmicroseconds | log.Lshortfile)
	l.SetLevel(LDebug, LInfo, LWarn, LError, LFatal)
	l.SetWriter(os.Stderr)
	return l
}