// New returns a new leveled oklog logger. Each logged line will be annotated
// with a timestamp. The output always goes to stderr.
177722
func New(config *Config) log.Logger {
	var l log.Logger
	if config.Format.s == "logfmt" {
		l = log.NewLogfmtLogger(log.NewSyncWriter(os.Stderr))
	} else {
		l = log.NewJSONLogger(log.NewSyncWriter(os.Stderr))
	}

	l = level.NewFilter(l, config.Level.o)
	l = log.With(l, "ts", timestampFormat, "caller", log.DefaultCaller)
	return l
}
737141
func New(pluginName string) *Logger {
	lg := log.New(os.Stdout, "", log.Ldate|log.Ltime)
	if len(pluginName) == 0 {
		return &Logger{logger: lg}
	}
	return &Logger{
		prefix: fmt.Sprintf("[%s] ", pluginName),
		logger: lg,
	}
}
408641
func NewLogWriter(wo, we io.Writer) *LogWriter {
	if we == nil {
		we = wo
	}

	return &LogWriter{
		wo:    wo,
		we:    we,
		lvl:   DefaultLevel,
		state: nil,
	}
}
322838
func New(errMsg string) *Error {
	if NewLine {
		errMsg += "\n"
	}
	return &Error{message: Prefix + errMsg}
}
361459
func New(ctx ...interface{}) MultiLogger {
	r := &RevelLogger{Logger: log15.New(ctx...)}
	r.SetStackDepth(1)
	return r
}
158404
func New(logger kitlog.Logger) log.Logger {
	if logger == nil {
		logger = kitlog.NewLogfmtLogger(kitlog.NewSyncWriter(os.Stdout))
	}

	return &shim{logger: logger}
}
748537
func New(opts ...OptFunc) *Logger {
	l := &Logger{lg: log.New(os.Stderr, "", LstdFlags&maskStdLogFlags), flag: LstdFlags, min: TRACE}
	for _, opt := range opts {
		opt(l)
	}
	return l
}
1367486
func New(msg string, args ...interface{}) *Error {
	return &Error{
		msg:   fmt.Sprintf(msg, args...),
		stack: debug.Stack(),
		level: 0,
	}
}
259097
func (opt Options) New(c context.Context) output.Output {
	o := fileOutput{
		Context: c,
		Options: &opt,
		streams: map[types.StreamPath]*stream{},
	}
	if opt.Track {
		o.et = &output.EntryTracker{}
	}
	return &o
}
71351
func (c *context) New(prefixes ...interface{}) Logger {
	return newContext(c.logger, c.prefix, prefixes...)
}
622866
func New(message string, field string, kind Kind) Error {
	return Error{message, field, 0, kind}
}
1127818
func New(info logger.Info) (logger.Logger, error) {
	var capval int64 = -1
	if capacity, ok := info.Config["max-size"]; ok {
		var err error
		capval, err = units.FromHumanSize(capacity)
		if err != nil {
			return nil, err
		}
		if capval <= 0 {
			return nil, fmt.Errorf("max-size must be a positive number")
		}
	}
	var maxFiles = 1
	if maxFileString, ok := info.Config["max-file"]; ok {
		var err error
		maxFiles, err = strconv.Atoi(maxFileString)
		if err != nil {
			return nil, err
		}
		if maxFiles < 1 {
			return nil, fmt.Errorf("max-file cannot be less than 1")
		}
	}

	var compress bool
	if compressString, ok := info.Config["compress"]; ok {
		var err error
		compress, err = strconv.ParseBool(compressString)
		if err != nil {
			return nil, err
		}
		if compress && (maxFiles == 1 || capval == -1) {
			return nil, fmt.Errorf("compress cannot be true when max-file is less than 2 or max-size is not set")
		}
	}

	attrs, err := info.ExtraAttributes(nil)
	if err != nil {
		return nil, err
	}

	// no default template. only use a tag if the user asked for it
	tag, err := loggerutils.ParseLogTag(info, "")
	if err != nil {
		return nil, err
	}
	if tag != "" {
		attrs["tag"] = tag
	}

	var extra []byte
	if len(attrs) > 0 {
		var err error
		extra, err = json.Marshal(attrs)
		if err != nil {
			return nil, err
		}
	}

	buf := bytes.NewBuffer(nil)
	marshalFunc := func(msg *logger.Message) ([]byte, error) {
		if err := marshalMessage(msg, extra, buf); err != nil {
			return nil, err
		}
		b := buf.Bytes()
		buf.Reset()
		return b, nil
	}

	writer, err := loggerutils.NewLogFile(info.LogPath, capval, maxFiles, compress, marshalFunc, decodeFunc, 0640, getTailReader)
	if err != nil {
		return nil, err
	}

	return &JSONFileLogger{
		writer:  writer,
		readers: make(map[*logger.LogWatcher]struct{}),
		tag:     tag,
	}, nil
}
856963
func New(loader Loader) *Env {
	if loader == nil {
		loader = &StringLoader{}
	}
	return &Env{loader, make(map[string]Func), make(map[string]Filter), make(map[string]Test), make([]parse.NodeVisitor, 0)}
}
414121
func (a *adapter) New(data ...interface{}) goa.LogAdapter {
	return &adapter{Logger: a.Logger.New(data...)}
}
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
}
2759
func NewLogger(prefixes Prefixes, defaultStyle TextStyle) *Logger {
	prefixes[""] = defaultStyle
	return &Logger{Prefixes: prefixes, output: os.Stdout}
}
964257
func (a *adapter) New(data ...interface{}) goa.LogAdapter {
	return &adapter{Entry: a.Entry.WithFields(data2rus(data))}
}