func (w *FileLogWriter) startLogger() error {
	fd, err := w.createLogFile()
	if err != nil {
		return err
	}
	w.mw.SetFd(fd)
	return w.initFd()
}
start file logger. create log file and set to locker-inside file writer.
package log
import (
	"bytes"
	"encoding/json"
	"errors"
	"fmt"
	"io"
	"log"
	"os"
	"path/filepath"
	"strings"
	"sync"
	"time"
)
type FileLogWriter struct {
	*log.Logger
	mw *MuxWriter
	Filename string `json:"filename"`
	Maxlines          int `json:"maxlines"`
	maxlines_curlines int
	Maxsize         int `json:"maxsize"`
	maxsize_cursize int
	Daily          bool  `json:"daily"`
	Maxdays        int64 `json:"maxdays"`
	daily_opendate int
	Rotate bool `json:"rotate"`
	startLock sync.Mutex  
	Level int `json:"level"`
	DrawColor bool `json:"drawcolor"`
}
type MuxWriter struct {
	sync.Mutex
	fd *os.File
}
func (l *MuxWriter) Write(b []byte) (int, error) {
	l.Lock()
	defer l.Unlock()
	return l.fd.Write(b)
}
func (l *MuxWriter) SetFd(fd *os.File) {
	if l.fd != nil {
		l.fd.Close()
	}
	l.fd = fd
}
func NewFileWriter() LoggerInterface {
	w := &FileLogWriter{
		Filename:  "",
		Maxlines:  1000000,
		Maxsize:   1 << 28,  
		Daily:     true,
		Maxdays:   30,
		Rotate:    true,
		Level:     LevelDebug,
		DrawColor: false,
	}
	w.mw = new(MuxWriter)
	w.Logger = log.New(w.mw, "", log.Ldate|log.Ltime)
	return w
}
func (w *FileLogWriter) Init(jsonconfig string) error {
	err := json.Unmarshal([]byte(jsonconfig), w)
	if err != nil {
		return err
	}
	if len(w.Filename) == 0 {
		return errors.New("jsonconfig must have filename")
	}
	err = w.startLogger()
	return err
}