util/log/file_logger.go
func NewFileLogger(conf *FileConfig) (Logger, io.Closer, error) {
	now := time.Now()
	if conf.UTC {
		now = now.UTC()
	}

	file, err := os.OpenFile(
		timeutil.Strftime(&now, conf.Filename),
		os.O_APPEND|os.O_CREATE|os.O_WRONLY, conf.FileMode)
	if err != nil {
		return nil, nil, err
	}

	logger, err := NewWriterLogger(conf.WriterConfig, file)
	if err != nil {
		file.Close()
		return nil, nil, err
	}

	return logger, file, nil
}
func NewFileLogger(conf *FileConfig) (Logger, io.Closer, error) {
	now := time.Now()
	if conf.UTC {
		now = now.UTC()
	}

	file, err := os.OpenFile(
		timeutil.Strftime(&now, conf.Filename),
		os.O_APPEND|os.O_CREATE|os.O_WRONLY, conf.FileMode)
	if err != nil {
		return nil, nil, err
	}

	logger, err := NewWriterLogger(conf.WriterConfig, file)
	if err != nil {
		file.Close()
		return nil, nil, err
	}

	return logger, file, nil
}
func NewFileLogger ( conf * FileConfig ) ( Logger , io . Closer , error ) { now := time . Now ( ) if conf . UTC { now = now . UTC ( ) } file , err := os . OpenFile ( timeutil . Strftime ( & now , conf . Filename ) , os . O_APPEND | os . O_CREATE | os . O_WRONLY , conf . FileMode ) if err != nil { return nil , nil , err } logger , err := NewWriterLogger ( conf . WriterConfig , file ) if err != nil { file . Close ( ) return nil , nil , err } return logger , file , nil }
// NewFileLogger creates a new file logger.
NewFileLogger creates a new file logger .