FileLogWriter implements LoggerInterface. It writes messages by lines limit, file size limit, or time frequency.
| 39 | // FileLogWriter implements LoggerInterface. |
| 40 | // It writes messages by lines limit, file size limit, or time frequency. |
| 41 | type FileLogWriter struct { |
| 42 | *log.Logger |
| 43 | mw *MuxWriter |
| 44 | // The opened file |
| 45 | Filename string `json:"filename"` |
| 46 | |
| 47 | Maxlines int `json:"maxlines"` |
| 48 | maxlines_curlines int |
| 49 | |
| 50 | // Rotate at size |
| 51 | Maxsize int `json:"maxsize"` |
| 52 | maxsize_cursize int |
| 53 | |
| 54 | // Rotate daily |
| 55 | Daily bool `json:"daily"` |
| 56 | Maxdays int64 `json:"maxdays"` |
| 57 | daily_opendate int |
| 58 | |
| 59 | Rotate bool `json:"rotate"` |
| 60 | |
| 61 | startLock sync.Mutex // Only one log can write to the file |
| 62 | |
| 63 | Level int `json:"level"` |
| 64 | } |
| 65 | |
| 66 | // an *os.File writer with locker. |
| 67 | type MuxWriter struct { |
nothing calls this directly
no outgoing calls
no test coverage detected