func (fs *FileStore) Store(item *log.LogItem) (err error) { file, err := fs.getFile(item) if err != nil { return } logInfo := log.ParseLogItem(fs.config.MsgTmpl, fs.config.TimeTmpl, item) _, err = file.WriteString(logInfo) if err != nil { return } finfo, err := file.Stat() if err != nil { return } else if finfo.Size() >= fs.config.Size { fs.file.Close() fs.file = nil } return }
func (lm *_LogManage) stdout(tmpl, timetmpl interface{}, item *log.LogItem) { info := log.ParseLogItem(tmpl, timetmpl, item) os.Stdout.WriteString(info) }