// genLog generates log string from the format setting.
338829
func (logger *Logger) genLog(level Level, message string) string {
	fs := make([]interface{}, len(logger.recordArgs))
	r := new(record)
	r.message = message
	r.level = level
	r.genNonRuntime(logger)
	if logger.runtime {
		r.genRuntime()
	}
	for k, v := range logger.recordArgs {
		fs[k] = fields[v](logger, r)
	}
	return fmt.Sprintf(logger.recordFormat, fs...)
}
1123375
func (s *agentLoggingStrategy) WriteLog(m params.LogRecord) error {
	level, _ := loggo.ParseLevel(m.Level)
	dbErr := errors.Annotate(s.dblogger.Log([]state.LogRecord{{
		Time:     m.Time,
		Entity:   s.entity,
		Version:  s.version,
		Module:   m.Module,
		Location: m.Location,
		Level:    level,
		Message:  m.Message,
	}}), "logging to DB failed")

	m.Entity = s.entity.String()
	fileErr := errors.Annotate(
		logToFile(s.fileLogger, s.filePrefix, m),
		"logging to logsink.log failed",
	)
	err := dbErr
	if err == nil {
		err = fileErr
	} else if fileErr != nil {
		err = errors.Errorf("%s; %s", dbErr, fileErr)
	}
	return err
}
380105
func UncompressLog(log string) (_ io.ReadCloser, retErr error) {
	if !strings.HasSuffix(log, compressSuffix) {
		return nil, fmt.Errorf("log is not compressed")
	}
	f, err := os.Open(log)
	if err != nil {
		return nil, fmt.Errorf("failed to open log: %v", err)
	}
	defer func() {
		if retErr != nil {
			f.Close()
		}
	}()
	r, err := gzip.NewReader(f)
	if err != nil {
		return nil, fmt.Errorf("failed to create gzip reader: %v", err)
	}
	return &compressReadCloser{f: f, Reader: r}, nil
}
234261
func (logger *Logger) Log(level Level, v ...interface{}) {
	// Don't delete this calling. The calling is used to keep the same
	// calldepth for all the logging functions. The calldepth is used to
	// get runtime information such as line number, function name, etc.
	logger.log(level, v...)
}
1132324
func (m *Manager) log(s string, v ...interface{}) {
	if m.Logf != nil {
		m.Logf(s, v...)
	}
}
254323
func generateLogs() {
	myLogger := logRegistry.NewLogger("MyLogger")

	for range time.NewTicker(10 * time.Second).C {

		myLogger.Debug("My logger")
		myLogger.Info("My logger")
		myLogger.Error("My logger")

		defaultLogger.Debug("Default logger")
		defaultLogger.Info("Default logger")
		defaultLogger.Error("Default logger")
	}
}
1262342
func (logger *Logger) log(level Level, v ...interface{}) {
	if int32(level) >= atomic.LoadInt32((*int32)(&logger.level)) {
		if logger.runtime || logger.sync {
			message := fmt.Sprint(v...)
			message = logger.genLog(level, message)
			logger.flushMsg(message)
		} else {
			r := new(request)
			r.level = level
			r.v = v
			logger.request <- *r
		}
	}
}
1358785
func (c *config) log(event Event, err error, args ...interface{}) {
	if c.lfunc != nil {
		c.lfunc(event, err, args...)
	}
}
1191295
func (f *Field) Log(x byte) int {
	if x == 0 {
		return -1
	}
	return int(f.log[x])
}
18607
func (e *Error) GenByArgs(args ...interface{}) *Error {
	err := *e
	err.args = args
	_, err.file, err.line, _ = runtime.Caller(1)
	return &err
}
776988
func (h *Handler) HandleLog(e *log.Entry) error {
	b, err := json.Marshal(e)
	if err != nil {
		return err
	}

	uuid := h.gen.Next()
	key := base64.StdEncoding.EncodeToString(uuid[:])
	return h.producer.Put(b, key)
}
1307242
func (l SamplingEventLogger) Log(id EventID, e Event) {
	l.m.Lock()
	defer l.m.Unlock()

	r, ok := l.rootRates[id.Root]
	if !ok {
		r, ok = l.rates[e.Schema()]
	}

	if ok && r < l.r.Float64() {
		return
	}

	l.l.Log(id, e)
}
619203
func (r *record) genNonRuntime(logger *Logger) {
	r.seqid = atomic.AddUint64(&(logger.seqid), 1)
	r.time = time.Now()
}
1108210
func (l Logger) log(logFunc func(string) error, format string, a ...interface{}) error {
	return logFunc(l.sprintf(format, a...))
}
652968
func Log(logger []Logger, statement string, duration time.Duration, err error) {
	for _, l := range logger {
		l(statement, duration, err)
	}
}
1117057
func (l *ChannelLogger) Log(data Data) error {
	l.channel <- data
	return nil
}
237444
func TimeLog(name string, start time.Time, out func(string, ...interface{})) {
	out("time> %s: %s", name, time.Since(start))
}