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")
	}
	w.suffix = filepath.Ext(w.Filename)
	w.fileNameOnly = strings.TrimSuffix(w.Filename, w.suffix)
	if w.suffix == "" {
		w.suffix = ".log"
	}
	err = w.startLogger()
	return err
}
Init file logger with json config.
jsonConfig like:
{
"filename":"logs/beego.log",
"maxLines":10000,
"maxsize":1024,
"daily":true,
"maxDays":15,
"rotate":true,
"perm":"0600"
}
package logs
import (
	"bytes"
	"encoding/json"
	"errors"
	"fmt"
	"io"
	"os"
	"path"
	"path/filepath"
	"strconv"
	"strings"
	"sync"
	"time"
)
type fileLogWriter struct {
	sync.RWMutex  
	Filename   string `json:"filename"`
	fileWriter *os.File
	MaxLines         int `json:"maxlines"`
	maxLinesCurLines int
	MaxFiles         int `json:"maxfiles"`
	MaxFilesCurFiles int
	MaxSize        int `json:"maxsize"`
	maxSizeCurSize int
	Daily         bool  `json:"daily"`
	MaxDays       int64 `json:"maxdays"`
	dailyOpenDate int
	dailyOpenTime time.Time
	Hourly         bool  `json:"hourly"`
	MaxHours       int64 `json:"maxhours"`
	hourlyOpenDate int
	hourlyOpenTime time.Time
	Rotate bool `json:"rotate"`
	Level int `json:"level"`
	Perm string `json:"perm"`
	RotatePerm string `json:"rotateperm"`
	fileNameOnly, suffix string  
}
func newFileWriter() Logger {
	w := &fileLogWriter{
		Daily:      true,
		MaxDays:    7,
		Hourly:     false,
		MaxHours:   168,
		Rotate:     true,
		RotatePerm: "0440",
		Level:      LevelTrace,
		Perm:       "0660",
		MaxLines:   10000000,
		MaxFiles:   999,
		MaxSize:    1 << 28,
	}
	return w
}