glog_file.go
func (l *Log) create(tag string, t time.Time) (f *os.File, filename string, err error) {
	if len(l.logDirs) == 0 {
		return nil, "", errors.New("log: no log dirs")
	}
	name, link := logName(l.name, tag, t)
	var lastErr error
	for _, dir := range l.logDirs {
		fname := filepath.Join(dir, name)
		f, err := os.Create(fname)
		if err == nil {
			symlink := filepath.Join(dir, link)
			os.Remove(symlink)        // ignore err
			os.Symlink(name, symlink) // ignore err
			return f, fname, nil
		}
		lastErr = err
	}
	return nil, "", fmt.Errorf("log: cannot create log: %v", lastErr)
}
func (l *Log) create(tag string, t time.Time) (f *os.File, filename string, err error) {
	if len(l.logDirs) == 0 {
		return nil, "", errors.New("log: no log dirs")
	}
	name, link := logName(l.name, tag, t)
	var lastErr error
	for _, dir := range l.logDirs {
		fname := filepath.Join(dir, name)
		f, err := os.Create(fname)
		if err == nil {
			symlink := filepath.Join(dir, link)
			os.Remove(symlink)        // ignore err
			os.Symlink(name, symlink) // ignore err
			return f, fname, nil
		}
		lastErr = err
	}
	return nil, "", fmt.Errorf("log: cannot create log: %v", lastErr)
}
// create creates a new log file and returns the file and its filename, which
// contains tag ("INFO", "FATAL", etc.) and t.  If the file is created
// successfully, create also attempts to update the symlink for that tag, ignoring
// errors.