// NewLog creates new logger
496216
func NewLog(level string) (*log.Logger, error) {

	lvl, err := colog.ParseLevel(level)
	if err != nil {
		return nil, err
	}

	cl := colog.NewCoLog(os.Stderr, "", log.Lshortfile|log.Ldate|log.Ltime)
	cl.SetMinLevel(lvl)
	cl.SetDefaultLevel(lvl)
	lg := cl.NewLogger()
	return lg, nil
}
866739
func NewLog() *Log {
	l := &Log{
		Palette: &DefaultPalette,
		enabled: make(map[string]bool),
		TimeFmt: defaultTimeFmt,
	}
	l.enabled[""] = true
	if !terminal.IsTerminal(int(os.Stdout.Fd())) || os.Getenv("TERM") == "dumb" {
		l.Color(false)
	}
	return l
}
392424
func New(out io.Writer, threshold log.Level) *Logger {
	return &Logger{
		out:       out,
		threshold: threshold,
		Formatter: defaultFormater,
		Writer:    defaultWriter,
	}
}
937294
func New(info logger.Info) (logger.Logger, error) {
	if info.LogPath == "" {
		return nil, errdefs.System(errors.New("log path is missing -- this is a bug and should not happen"))
	}

	cfg := newDefaultConfig()
	if capacity, ok := info.Config["max-size"]; ok {
		var err error
		cfg.MaxFileSize, err = units.FromHumanSize(capacity)
		if err != nil {
			return nil, errdefs.InvalidParameter(errors.Wrapf(err, "invalid value for max-size: %s", capacity))
		}
	}

	if userMaxFileCount, ok := info.Config["max-file"]; ok {
		var err error
		cfg.MaxFileCount, err = strconv.Atoi(userMaxFileCount)
		if err != nil {
			return nil, errdefs.InvalidParameter(errors.Wrapf(err, "invalid value for max-file: %s", userMaxFileCount))
		}
	}

	if userCompress, ok := info.Config["compress"]; ok {
		compressLogs, err := strconv.ParseBool(userCompress)
		if err != nil {
			return nil, errdefs.InvalidParameter(errors.Wrap(err, "error reading compress log option"))
		}
		cfg.DisableCompression = !compressLogs
	}
	return newDriver(info.LogPath, cfg)
}
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
}
354339
func NewLogger(f *Fibre) *Logger {

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

}
346985
func NewLogRegistry() logging.Registry {
	registry := &logRegistry{
		loggers:      new(sync.Map),
		logLevels:    make(map[string]logrus.Level),
		defaultLevel: initialLogLvl,
	}
	// put default logger
	registry.putLoggerToMapping(defaultLogger)
	return registry
}
233879
func New(logger *logrus.Logger) log.Logger {
	if logger == nil {
		logger = logrus.StandardLogger()
	}

	return &shim{logrus.NewEntry(logger)}
}
107445
func NewLogger(out io.Writer, prefix string, flag int) *Logger {
	return &Logger{out: out, prefix: prefix, flag: flag}
}
813469
func NewLog(min, max float64, base int) (Log, error) {
	if min > max {
		min, max = max, min
	}

	if base <= 1 {
		return Log{}, RangeErr("Log scale base must be 2 or more")
	}
	if min <= 0 && max >= 0 {
		return Log{}, RangeErr("Log scale range cannot include 0")
	}

	return Log{Min: min, Max: max, Base: base}, nil
}
283530
func NewAppLog(loggerName string, msg []byte) *AppLog {
	now := time.Now().UTC()
	return &AppLog{
		Timestamp:  now.UnixNano(),
		Time:       now.Format(time.RFC3339),
		Type:       "app.log",
		Logger:     loggerName,
		Hostname:   hostname,
		EnvVersion: "2.0",
		Pid:        os.Getpid(),
		Fields: map[string]interface{}{
			"msg": string(bytes.TrimSpace(msg)),
		},
	}
}
158404
func New(logger kitlog.Logger) log.Logger {
	if logger == nil {
		logger = kitlog.NewLogfmtLogger(kitlog.NewSyncWriter(os.Stdout))
	}

	return &shim{logger: logger}
}
2759
func NewLogger(prefixes Prefixes, defaultStyle TextStyle) *Logger {
	prefixes[""] = defaultStyle
	return &Logger{Prefixes: prefixes, output: os.Stdout}
}
507854
func (r *LogResponse) AddLog(log *bees.LogMessage) {
	r.logs = append(r.logs, log)
	r.Logs = append(r.Logs, prepareLogResponse(r.Context, log))
}
1216173
func NewLoggingHandler(
	w io.Writer,
	logHTTPRequests, logHTTPResponses bool) types.Middleware {

	return &loggingHandler{
		writer:       w,
		logRequests:  logHTTPRequests,
		logResponses: logHTTPResponses,
	}
}
887688
func NewLogger(minLogLevel LogLevel) Logger {
	sink := writerSink{
		writer:      os.Stdout,
		minLogLevel: minLogLevel,
	}
	return &logger{
		sinks: []Sink{sink},
	}
}
447201
func NewLoggerFromLoggingConfig(loggingConfig *logconfig.LoggingConfig) (*logging.Logger, error) {
	if loggingConfig == nil {
		return NewStdErrLogger()
	} else {
		outputLogger, errCh, err := loggerFromLoggingConfig(loggingConfig)
		if err != nil {
			return nil, err
		}
		logger := logging.NewLogger(outputLogger)
		if !loggingConfig.Trace {
			logger.Trace = log.NewNopLogger()
		}
		go func() {
			err := <-errCh.Out()
			if err != nil {
				fmt.Printf("Logging error: %v", err)
			}
		}()
		return logger, nil
	}
}