fileLogger.go
func (f *FileLogger) isMustSplit() bool {

	switch f.splitType {
	case SplitType_Size:
		logFile := joinFilePath(f.fileDir, f.fileName)
		if f.fileCount > 1 {
			if fileSize(logFile) >= f.fileSize {
				return true
			}
		}
	case SplitType_Daily:
		t, _ := time.Parse(DATEFORMAT, time.Now().Format(DATEFORMAT))
		if t.After(*f.date) {
			return true
		}
	}

	return false
}
func (f *FileLogger) isMustSplit() bool {

	switch f.splitType {
	case SplitType_Size:
		logFile := joinFilePath(f.fileDir, f.fileName)
		if f.fileCount > 1 {
			if fileSize(logFile) >= f.fileSize {
				return true
			}
		}
	case SplitType_Daily:
		t, _ := time.Parse(DATEFORMAT, time.Now().Format(DATEFORMAT))
		if t.After(*f.date) {
			return true
		}
	}

	return false
}
func ( f * FileLogger ) isMustSplit ( ) bool { switch f . splitType { case SplitType_Size : logFile := joinFilePath ( f . fileDir , f . fileName ) if f . fileCount > 1 { if fileSize ( logFile ) >= f . fileSize { return true } } case SplitType_Daily : t , _ := time . Parse ( DATEFORMAT , time . Now ( ) . Format ( DATEFORMAT ) ) if t . After ( * f . date ) { return true } } return false }
// used for determine the fileLogger f is time to split.
// size: once the current fileLogger's fileSize >= config.fileSize need to split
// daily: once the current fileLogger stands for yesterday need to split
used for determine the fileLogger f is time to split . size : once the current fileLogger s fileSize > = config . fileSize need to split daily : once the current fileLogger stands for yesterday need to split