func OpenFile(name string) (file *os.File, err error) {
	if name == "" {
		return nil, ErrEmptyFileName
	}
	switch _, err = os.Stat(name); {
	case err == nil:
		file, err = os.OpenFile(name, os.O_APPEND|os.O_WRONLY, 0666)
		if err != nil {
			return file, fmt.Errorf("open: %w", err)
		}
	case os.IsNotExist(err):
		file, err = os.Create(name)
		if err != nil {
			return file, fmt.Errorf("create: %w", err)
		}
	}
	return file, nil
}
OpenFile opens file for append strings. Creates file if file not exist.
package logger
import (
	"errors"
	"fmt"
	"os"
	"time"
)
const DefaultTimeLayout = "2006-01-02 15:04:05"
const DefaultLineFormat = "[%s] %s: %s\n%s\n\n"
var ErrEmptyFileName = errors.New("empty file name")