// RotateLines get log rotate lines
549024
func (writer *baseFileWriter) RotateLines() int {
	writer.lock.RLock()
	defer writer.lock.RUnlock()
	return writer.rotateLines
}
530017
func LogRotate(path string, MaxFileSize int, MaxBackupCount int) {
	//filter .log .trace files
	defer func() {
		if e := recover(); e != nil {
			Logger.Errorf("LogRotate catch an exception")
		}
	}()

	pat := `.(\.log|\.trace|\.out)$`
	fileList, err := FilterFileList(path, pat)
	if err != nil {
		Logger.Errorf("filepath.Walk() path: %s failed.", path)
		return
	}

	for _, file := range fileList {
		logRotateFile(file, MaxFileSize, MaxBackupCount)
	}
}
912326
func rotate(item interface{}) interface{} {
	if items, ok := item.([]interface{}); ok {
		for _, item = range items {
			if errcode, ok := rotate(item).(errors.ErrCode); ok {
				return errcode
			}
		}
	}
	return item
}
284652
func (u *UI) Line(format string, a ...interface{}) {
	u.LineIndent(0, format, a...)
}
737950
func (vec *T) RotateAroundPoint(point *T, angle float32) *T {
	return vec.Sub(point).Rotate(angle).Add(point)
}
1296064
func (l *FileLog) rotateLog() (err error) {
	l.Lock()
	defer l.Unlock()

	// determine the timestamp for the current log file
	fileTime := l.Clock.Now().In(time.UTC)

	// truncate time to the resolution of one day, cutting at the day end boundary
	fileTime = time.Date(fileTime.Year(), fileTime.Month(), fileTime.Day(), 0, 0, 0, 0, time.UTC)

	logFilename := filepath.Join(l.Dir,
		fileTime.Format(defaults.AuditLogTimeFormat)+LogfileExt)

	openLogFile := func() error {
		l.file, err = os.OpenFile(logFilename, os.O_WRONLY|os.O_CREATE|os.O_APPEND, 0640)
		if err != nil {
			log.Error(err)
		}
		l.fileTime = fileTime
		return trace.Wrap(err)
	}

	linkFilename := filepath.Join(l.SymlinkDir, SymlinkFilename)
	createSymlink := func() error {
		err = trace.ConvertSystemError(os.Remove(linkFilename))
		if err != nil {
			if !trace.IsNotFound(err) {
				return trace.Wrap(err)
			}
		}
		return trace.ConvertSystemError(os.Symlink(logFilename, linkFilename))
	}

	// need to create a log file?
	if l.file == nil {
		if err := openLogFile(); err != nil {
			return trace.Wrap(err)
		}
		return trace.Wrap(createSymlink())
	}

	// time to advance the logfile?
	if l.fileTime.Before(fileTime) {
		l.file.Close()
		if err := openLogFile(); err != nil {
			return trace.Wrap(err)
		}
		return trace.Wrap(createSymlink())
	}
	return nil
}
858275
func Rotate(cfg *config.Config) (io.Writer, error) {
	format, found := cfg.Attrs["filename"]
	if !found {
		return nil, argNotFoundErr("rotate", "filename")
	}

	dir, found := cfg.Attrs["dir"]
	if !found {
		return nil, argNotFoundErr("rotate", "dir")
	}

	sizeStr, found := cfg.Attrs["size"]
	if !found {
		return nil, argNotFoundErr("rotate", "size")
	}

	size, err := toByte(sizeStr)
	if err != nil {
		return nil, err
	}

	return rotate.New(format, dir, size)
}
178051
func rotate(data Interface, a, m, b int) {
	i := m - a
	j := b - m

	for i != j {
		if i > j {
			swapRange(data, m-i, m, j)
			i -= j
		} else {
			swapRange(data, m-i, m+j-i, i)
			j -= i
		}
	}
	// i == j
	swapRange(data, m-i, m, i)
}
696402
func MultiLine(logFn func(args ...interface{}), output string) {
	scanner := bufio.NewScanner(bytes.NewReader([]byte(output)))
	for scanner.Scan() {
		logFn(scanner.Text())
	}
}
772122
func (l *Logger) logLine(str string) (n int, err error) {
	padding := strings.Repeat(" ", maxInt(0, l.widthFn()-len(str)))

	return l.log(str + padding + "\r")
}
333301
func GetAllLogs(log string) ([]string, error) {
	// pattern is used to match all rotated files.
	pattern := fmt.Sprintf("%s.*", log)
	logs, err := filepath.Glob(pattern)
	if err != nil {
		return nil, fmt.Errorf("failed to list all log files with pattern %q: %v", pattern, err)
	}
	inuse, _ := filterUnusedLogs(logs)
	sort.Strings(inuse)
	return append(inuse, log), nil
}
1265606
func (b *AESGCMBarrier) Rotate(ctx context.Context) (uint32, error) {
	b.l.Lock()
	defer b.l.Unlock()
	if b.sealed {
		return 0, ErrBarrierSealed
	}

	// Generate a new key
	encrypt, err := b.GenerateKey()
	if err != nil {
		return 0, errwrap.Wrapf("failed to generate encryption key: {{err}}", err)
	}

	// Get the next term
	term := b.keyring.ActiveTerm()
	newTerm := term + 1

	// Add a new encryption key
	newKeyring, err := b.keyring.AddKey(&Key{
		Term:    newTerm,
		Version: 1,
		Value:   encrypt,
	})
	if err != nil {
		return 0, errwrap.Wrapf("failed to add new encryption key: {{err}}", err)
	}

	// Persist the new keyring
	if err := b.persistKeyring(ctx, newKeyring); err != nil {
		return 0, err
	}

	// Swap the keyrings
	b.keyring = newKeyring
	return newTerm, nil
}
467649
func (cl *ChannelLogger) ReadLogLine() []interface{} {
	select {
	case logLine, ok := <-cl.ch.Out():
		return readLogLine(logLine, ok)
	default:
		return nil
	}
}
147119
func splitLine(line string) []string {
	if line == "" {
		return nil
	}
	if n := strings.IndexByte(line, '#'); n >= 0 {
		line = line[:n]
	}
	line = strings.Replace(line, "\t", " ", -1)
	line = strings.TrimSpace(line)

	var ss []string
	for _, s := range strings.Split(line, " ") {
		if s = strings.TrimSpace(s); s != "" {
			ss = append(ss, s)
		}
	}
	return ss
}
97537
func (vec *T) Rotate(angle float32) *T {
	*vec = vec.Rotated(angle)
	return vec
}
296606
func (m *Matrix) Rotate(deg float32) *Matrix {
	return m.RotateRad(deg * DegToRad)
}
1307520
func Rotate(dst draw.Image, src image.Image, opt *RotateOptions) error {
	if dst == nil {
		return errors.New("graphics: dst is nil")
	}
	if src == nil {
		return errors.New("graphics: src is nil")
	}

	angle := 0.0
	if opt != nil {
		angle = opt.Angle
	}

	return I.Rotate(angle).TransformCenter(dst, src, interp.Bilinear)
}