// LogActive causes all existing transactions to be logged when they complete.
// The logging is throttled to no more than once every txLogInterval.
350772
func (axp *TxPool) LogActive() {
	axp.logMu.Lock()
	defer axp.logMu.Unlock()
	if time.Since(axp.lastLog) < txLogInterval {
		return
	}
	axp.lastLog = time.Now()
	conns := axp.activePool.GetAll()
	for _, c := range conns {
		c.(*TxConnection).LogToFile.Set(1)
	}
}
558126
func (lr *LogRecord) Log() {
	flowdebug.Log(lr.getLogFields(), "Logging flow record")

	// Lock while writing access log so we serialize writes as we may have
	// to reopen the logfile and parallel writes could fail because of that
	logMutex.Lock()
	defer logMutex.Unlock()

	lr.Metadata = metadata

	if notifier != nil {
		notifier.NewProxyLogRecord(lr)
	}

	if logger == nil {
		flowdebug.Log(log.WithField(FieldFilePath, logPath),
			"Skipping writing to access log (logger nil)")
		return
	}

	if _, err := logger.Write(lr.getRawLogMessage()); err != nil {
		log.WithError(err).WithField(FieldFilePath, logPath).
			Errorf("Error writing to access file")
	}
}
1049179
func (d DefaultLogger) Log(level LogLevel, a ...interface{}) (n int, err error) {
	if level >= logThreshhold {
		fmt.Fprint(os.Stderr, prefix(level)+" ")
		return fmt.Fprintln(os.Stderr, a...)
	}
	return 0, nil
}
701968
func (tx *transaction) notifyActiveIters() {
	tx.activeIterLock.RLock()
	for _, iter := range tx.activeIters {
		iter.ForceReseek()
	}
	tx.activeIterLock.RUnlock()
}
592733
func (h *sqlHelper) Transact(logger lager.Logger, db QueryableDB, f func(logger lager.Logger, tx Tx) error) error {
	var err error

	for attempts := 0; attempts < 3; attempts++ {
		err = func() error {
			tx, err := db.Begin()
			if err != nil {
				logger.Error("failed-starting-transaction", err)
				return err
			}
			defer tx.Rollback()

			err = f(logger, tx)
			if err != nil {
				return err
			}

			err = tx.Commit()
			if err != nil {
				logger.Error("failed-committing-transaction", err)

			}
			return err
		}()

		convertedErr := h.ConvertSQLError(err)
		// golang sql package does not always retry query on ErrBadConn, e.g. if it
		// is in the middle of a transaction. This make sense since the package
		// cannot retry the entire transaction and has to return control to the
		// caller to initiate a retry
		if attempts >= 2 || (convertedErr != ErrDeadlock && convertedErr != driver.ErrBadConn && convertedErr != mysql.ErrInvalidConn) {
			break
		} else {
			logger.Error("deadlock-transaction", err, lager.Data{"attempts": attempts})
			time.Sleep(500 * time.Millisecond)
		}
	}

	return err
}
1276703
func (e *EmptyService) Log(ctx context.Context, follow bool) error {
	return nil
}
985926
func Transactional(db *gorm.DB, todo func(tx *gorm.DB) error) error {
	tx := db.Begin()
	if tx.Error != nil {
		return tx.Error
	}
	if err := todo(tx); err != nil {
		tx.Rollback()
		return errs.WithStack(err)
	}
	tx.Commit()
	return tx.Error
}
1303520
func (f *Filter) Logs(ctx context.Context) ([]*types.Log, error) {
	// If we're doing singleton block filtering, execute and return
	if f.block != (common.Hash{}) {
		header, err := f.backend.HeaderByHash(ctx, f.block)
		if err != nil {
			return nil, err
		}
		if header == nil {
			return nil, errors.New("unknown block")
		}
		return f.blockLogs(ctx, header)
	}
	// Figure out the limits of the filter range
	header, _ := f.backend.HeaderByNumber(ctx, rpc.LatestBlockNumber)
	if header == nil {
		return nil, nil
	}
	head := header.Number.Uint64()

	if f.begin == -1 {
		f.begin = int64(head)
	}
	end := uint64(f.end)
	if f.end == -1 {
		end = head
	}
	// Gather all indexed logs, and finish with non indexed ones
	var (
		logs []*types.Log
		err  error
	)
	size, sections := f.backend.BloomStatus()
	if indexed := sections * size; indexed > uint64(f.begin) {
		if indexed > end {
			logs, err = f.indexedLogs(ctx, end)
		} else {
			logs, err = f.indexedLogs(ctx, indexed-1)
		}
		if err != nil {
			return logs, err
		}
	}
	rest, err := f.unindexedLogs(ctx, end)
	logs = append(logs, rest...)
	return logs, err
}
750065
func (r *Repository) Log(o *LogOptions) (object.CommitIter, error) {
	fn := commitIterFunc(o.Order)
	if fn == nil {
		return nil, fmt.Errorf("invalid Order=%v", o.Order)
	}

	var (
		it  object.CommitIter
		err error
	)
	if o.All {
		it, err = r.logAll(fn)
	} else {
		it, err = r.log(o.From, fn)
	}

	if err != nil {
		return nil, err
	}

	if o.FileName != nil {
		// for `git log --all` also check parent (if the next commit comes from the real parent)
		it = r.logWithFile(*o.FileName, it, o.All)
	}

	return it, nil
}
289494
func (s *UpdateTagOptionInput) SetActive(v bool) *UpdateTagOptionInput {
	s.Active = &v
	return s
}
88522
func (rdb RethinkDBKeyStore) markActive(keyID string) error {
	_, err := gorethink.DB(rdb.dbName).Table(PrivateKeysRethinkTable.Name).Get(keyID).Update(map[string]interface{}{
		"last_used": rdb.nowFunc(),
	}).RunWrite(rdb.sess)
	return err
}
1317481
func NewLogActionFn(ctx RuleContext) interface{} {
	l := &LogAction{ctx: ctx}
	writer, ok := ctx.(io.Writer)
	if ok && writer != nil {
		l.writer = writer
	}
	return l.Log
}
1218590
func (cl *Call) Log(arguments ...interface{}) {
	cl.scope.log(cl.entry, fmt.Sprintln(arguments...))
}
140367
func (e *Endpoint) LogStatusOKLocked(typ StatusType, msg string) {
	e.logStatusLocked(typ, OK, msg)
}
838708
func (logger *Logger) Log(prefix, message string) {
	textStyle, ok := logger.Prefixes[prefix]
	if !ok {
		textStyle, ok = logger.Prefixes[""]
		if !ok {
			textStyle = Default
		}
	}

	out := logger.getOutput()

	logger.mu.Lock()
	defer logger.mu.Unlock()

	ct.ChangeColor(
		textStyle.Foreground.Color,
		textStyle.Foreground.Bright,
		textStyle.Background.Color,
		textStyle.Background.Bright,
	)

	fmt.Fprintf(out, "%10s", prefix)

	ct.ResetColor()

	fmt.Fprintf(out, " %s\n", message)
}
1018462
func (b *BufferedLogger) Log(in []state.LogRecord) error {
	b.mu.Lock()
	defer b.mu.Unlock()
	for len(in) > 0 {
		r := cap(b.buf) - len(b.buf)
		n := len(in)
		if n > r {
			n = r
		}
		b.buf = append(b.buf, in[:n]...)
		in = in[n:]
		if len(b.buf) >= cap(b.buf) {
			if err := b.flush(); err != nil {
				return errors.Trace(err)
			}
		}
	}
	if len(b.buf) > 0 && b.flushTimer == nil {
		b.flushTimer = b.clock.AfterFunc(b.flushInterval, b.flushOnTimer)
	}
	return nil
}
1180128
func (l *withLogger) LogWith(level Level, calldepth int, data []byte, format string, args ...interface{}) {
	if l.GetLevel() >= level {
		l.output(level, calldepth, data, format, args...)
	}
}