(fpath string, cap int)
| 41 | } |
| 42 | |
| 43 | func NewJSONLogFile(fpath string, cap int) (userlog.UserLogFile, error) { |
| 44 | f, err := os.OpenFile(fpath, os.O_WRONLY|os.O_APPEND|os.O_CREATE, 0644) |
| 45 | if err != nil { |
| 46 | return nil, err |
| 47 | } |
| 48 | w := &JSONLogFile{ |
| 49 | writer: f, |
| 50 | capacity: int32(cap), |
| 51 | } |
| 52 | return w, nil |
| 53 | } |
| 54 | |
| 55 | func (f *JSONLogFile) Write(l *userlog.UserLog, buf []byte) (int, error) { |
| 56 | w := f.writer |
no outgoing calls