// config - using default config when nil
using default config when nil
// config - using default config when nil
func NewLogWriterFile(level LevelType, path string, fileName string, rotate bool, config *logWriterConfig) (*LogWriterFile, error) {
	if !pathExists(path) {
		return nil, fmt.Errorf("path not exists: %s", path)
	}
	if config == nil {
		config = NewLogWriterConfig()
	}
	fileUrl := filepath.Join(path, fileName)
	writer := &LogWriterFile{
		logWriterConfig: config,
		bus:             make(chan *logEntity, config.cacheSize),
		tickChan:        time.NewTicker(config.saveInterval),
		level:           level,
		fileUrl:         fileUrl,
		curFileUrl:      fileUrl + ".log",
		rotate:          rotate,
	}
	writer.refreshRotateDate(time.Now())
	go writer.serve()
	return writer, nil
}
func NewLogWriterFile ( level LevelType , path string , fileName string , rotate bool , config * logWriterConfig ) ( * LogWriterFile , error ) { if ! pathExists ( path ) { return nil , fmt . Errorf ( " " , path ) } if config == nil { config = NewLogWriterConfig ( ) } fileUrl := filepath . Join ( path , fileName ) writer := & LogWriterFile { logWriterConfig : config , bus : make ( chan * logEntity , config . cacheSize ) , tickChan : time . NewTicker ( config . saveInterval ) , level : level , fileUrl : fileUrl , curFileUrl : fileUrl + " " , rotate : rotate , } writer . refreshRotateDate ( time . Now ( ) ) go writer . serve ( ) return writer , nil }
using default config when nil
using default config when nil