// NewTimeformatLogger creates a logger writing to the passed
// output and with the time formatted with the passed time format.
556032
func NewTimeformatLogger(out io.Writer, timeFormat string) Logger {
	return &standardLogger{
		out:        out,
		timeFormat: timeFormat,
	}
}
237629
func newTimeoutReader(reader io.ReadCloser, timeout time.Duration, cancel func()) *timeoutReader {
	return &timeoutReader{
		reader:  reader,
		timeout: timeout,
		cancel:  cancel,
	}
}
652496
func NewTaskFormat(source string, quiet bool) formatter.Format {
	switch source {
	case formatter.TableFormatKey:
		if quiet {
			return formatter.DefaultQuietFormat
		}
		return defaultTaskTableFormat
	case formatter.RawFormatKey:
		if quiet {
			return `id: {{.ID}}`
		}
		return `id: {{.ID}}\nname: {{.Name}}\nimage: {{.Image}}\nnode: {{.Node}}\ndesired_state: {{.DesiredState}}\ncurrent_state: {{.CurrentState}}\nerror: {{.Error}}\nports: {{.Ports}}\n`
	}
	return formatter.Format(source)
}
183418
func ParseTime(s string) (time.Time, error) {
	t, err := time.Parse(logutil.SlowLogTimeFormat, s)
	if err != nil {
		// This is for compatibility.
		t, err = time.Parse(logutil.OldSlowLogTimeFormat, s)
		if err != nil {
			err = errors.Errorf("string \"%v\" doesn't has a prefix that matches format \"%v\", err: %v", s, logutil.SlowLogTimeFormat, err)
		}
	}
	return t, err
}
862367
func (RealTime) NewTimer(d time.Duration) Timer {
	return &builtinTimer{
		timer: time.NewTimer(d),
	}
}
757088
func GetFormatter(logger *StreamLogger) LogFormatter {
	return func(w io.Writer, params url.Values, val interface{}) error {
		fmter, ok := val.(Formatter)
		if !ok {
			_, err := fmt.Fprintf(w, "Error: unexpected value of type %T in %s!", val, logger.Name())
			return err
		}
		return fmter.Logf(w, params)
	}
}
490588
func (email *Email) SetTimestampFormat(format string) {
	email.rw.Lock()
	defer email.rw.Unlock()

	email.timestampFormat = format
}
1187846
func (f *CommonLogFormatter) Format(entry *logrus.Entry) ([]byte, error) {
	b := &bytes.Buffer{}

	var timestamp = defaultValue
	if v, ok := entry.Data[StartUTC]; ok {
		timestamp = v.(time.Time).Format(commonLogTimeFormat)
	}

	var elapsedMillis int64
	if v, ok := entry.Data[Duration]; ok {
		elapsedMillis = v.(time.Duration).Nanoseconds() / 1000000
	}

	_, err := fmt.Fprintf(b, "%s - %s [%s] \"%s %s %s\" %v %v %s %s %v %s %s %dms\n",
		toLog(entry.Data, ClientHost, defaultValue, false),
		toLog(entry.Data, ClientUsername, defaultValue, false),
		timestamp,
		toLog(entry.Data, RequestMethod, defaultValue, false),
		toLog(entry.Data, RequestPath, defaultValue, false),
		toLog(entry.Data, RequestProtocol, defaultValue, false),
		toLog(entry.Data, OriginStatus, defaultValue, true),
		toLog(entry.Data, OriginContentSize, defaultValue, true),
		toLog(entry.Data, "request_Referer", `"-"`, true),
		toLog(entry.Data, "request_User-Agent", `"-"`, true),
		toLog(entry.Data, RequestCount, defaultValue, true),
		toLog(entry.Data, RouterName, defaultValue, true),
		toLog(entry.Data, ServiceURL, defaultValue, true),
		elapsedMillis)

	return b.Bytes(), err
}
142835
func CreateLoggerAdapter(level Level, timeFormat string, format string, out io.Writer) *log.Logger {
	filter := newFilter(level, "/", timeFormat, format, out)
	go filter.run()
	return log.New(&internalWaiter{filter}, "", 0)
}
378085
func (l *Logger) Log(level Level, format string, a ...interface{}) {
	if level > l.MaxLevel || !l.open {
		return
	}
	message := format
	if len(a) > 0 {
		message = fmt.Sprintf(format, a...)
	}
	entry := &Entry{
		Category: l.Category,
		Level:    level,
		Message:  message,
		Time:     time.Now(),
	}
	if l.CallStackDepth > 0 {
		entry.CallStack = GetCallStack(3, l.CallStackDepth, l.CallStackFilter)
	}
	entry.FormattedMessage = l.Formatter(l, entry)
	l.entries <- entry
}
852847
func (engine *Engine) FormatTime(sqlTypeName string, t time.Time) (v interface{}) {
	return engine.formatTime(engine.TZLocation, sqlTypeName, t)
}
179280
func NewStdLogger() log.Logger {
	return log.LoggerFunc(func(format string, args ...interface{}) {
		glog.V(2).Infof(format, args...)
	})
}
5583
func NewTimer(interval time.Duration) *Timer {
	tm := &Timer{
		msg: make(chan typeAction),
	}
	tm.interval.Set(interval)
	return tm
}
112622
func (logger *Logger) time(r *record) interface{} {
	return r.time.Format(logger.timeFormat)
}
118370
func (d *defaulter) logFormatError(t string, err error) {
	d.logError(fmt.Sprintf("value has illegal format for %q", t), err)
}
915273
func NewTimeBased() (UUID, error) {
	u, err := timebased.NewUUID()
	if err != nil {
		return Nil, err
	}

	uuid := UUID{}
	copy(uuid[:], u)

	return uuid, nil
}
815690
func DefaultFormatter(l *Logger, e *Entry) string {
	return fmt.Sprintf("%v [%v][%v] %v%v", e.Time.Format(time.RFC3339), e.Level, e.Category, e.Message, e.CallStack)
}