// NewDistinctWarnLogger creates a new DistinctLogger that logs WARNs
495075
func NewDistinctWarnLogger() *DistinctLogger {
	return &DistinctLogger{m: make(map[string]bool), logger: jww.WARN}
}
354924
func NewLogger(out io.Writer) Logger {
	l := log.New(out, "[tango] ", log.Ldefault())
	l.SetOutputLevel(log.Ldebug)
	return l
}
1013753
func NewDispatcher(l log.Logger, unknownHandler Handler) Dispatcher {
	return &dispatcher{
		logger:   l,
		unknown:  unknownHandler,
		handlers: make(map[StreamType]Handler, 0),
	}
}
1209729
func NewLogger(prefix string, flags int, handler events.Handler) *log.Logger {
	return log.New(NewWriter(prefix, flags, handler), prefix, flags)
}
812800
func NewLogfmtLogger(w io.Writer, ErrHandler ErrorHandler) Logger {
	if w == ioutil.Discard {
		return Discard
	}
	return &ErrorLogLogger{
		RootLogger: &LogfmtLogger{
			Out:             w,
			MissingValueKey: Msg,
		},
		ErrHandler: ErrHandler,
	}
}
347926
func NewDefaultLogBuffer(message_buffer int) *LogBuffer {
	return NewLogBuffer(message_buffer, []*log.Logger{log.StandardLogger(), golib.Log})
}
709411
func NewConsoleLogger(lvl Level) Logger {
	os.Stderr.WriteString("warning: use of deprecated NewConsoleLogger\n")
	return Logger{
		"stdout": &Filter{lvl, NewConsoleLogWriter()},
	}
}
824500
func newOutputLogger(loggerToBufferFunc func(*logutilpb.Event)) logutil.Logger {
	return logutil.NewCallbackLogger(func(e *logutilpb.Event) {
		loggerToBufferFunc(e)
	})
}
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
}
16971
func NewPlainLogger(name string, l LevelInfo) (Sender, error) {
	return setup(MakePlainLogger(), name, l)
}
1344727
func (w *WebHookCommit) GetDistinct() bool {
	if w == nil || w.Distinct == nil {
		return false
	}
	return *w.Distinct
}
304050
func NewPlainErrorLogger(name string, l LevelInfo) (Sender, error) {
	return setup(MakePlainErrorLogger(), name, l)
}
493140
func NewJSONLogger(w io.Writer, ErrHandler ErrorHandler) Logger {
	if w == ioutil.Discard {
		return Discard
	}
	return &ErrorLogLogger{
		RootLogger: &JSONLogger{
			Out:             w,
			MissingValueKey: Msg,
		},
		ErrHandler: ErrHandler,
	}
}
796771
func InitLogger(logLevel int) {
	SetLogLevel(logLevel)
	if logLevel <= LDebug {
		log.SetFlags(log.LstdFlags | log.Lshortfile)
	}
}
203040
func NewMiddlewareFromLogger(logger *logrus.Logger, name string) *Middleware {
	return &Middleware{
		Logger: logger,
		Name:   name,
		Before: DefaultBefore,
		After:  DefaultAfter,

		logStarting: true,
		clock:       &realClock{},
	}
}
35956
func NewBuildlogger(name string, conf *BuildloggerConfig, l LevelInfo) (Sender, error) {
	s, err := MakeBuildlogger(name, conf)
	if err != nil {
		return nil, err
	}

	return setup(s, name, l)
}
614714
func NewLogHelper(v ...interface{}) (*LogHelper, error) {
	mask := os.O_APPEND | os.O_RDWR | os.O_CREATE
	mylog := LogHelper{}

	// use stdout & stderr
	if len(v) == 0 {
		mylog.Logger[0] = log.New(os.Stdout, "TRACE - ", FLAGS)
		mylog.Logger[1] = log.New(os.Stderr, "ERROR - ", FLAGS)
		return &mylog, nil
	}
	fileName := v[0].(string)
	// app.log & app.log.error
	mylog.LogFileNames = [2]string{fileName, fileName + ".error"}
	// check dir wether exist and mkdir
	if _, err := os.Stat(path.Dir(mylog.LogFileNames[0])); err != nil {
		os.Mkdir(path.Dir(mylog.LogFileNames[0]), 0777)
	}

	if logFile, err := os.OpenFile(mylog.LogFileNames[0], mask, 0666); err == nil {
		mylog.Logger[0] = log.New(logFile, "TRACE - ", FLAGS)
		mylog.Logger[0].Flags()
	} else {
		return nil, err
	}

	if logFile, err := os.OpenFile(mylog.LogFileNames[1], mask, 0666); err == nil {
		mylog.Logger[1] = log.New(logFile, "ERROR - ", FLAGS)
	} else {
		return nil, err
	}
	return &mylog, nil
}