Stylize log

This commit is contained in:
daru
2022-05-14 14:21:50 +02:00
parent f0555e8d6a
commit 0c2fb5c546
4 changed files with 22 additions and 18 deletions

View File

@@ -33,6 +33,10 @@ func (rb *RingBuf) WriteLine(in string) (int, error) {
return rb.Write([]byte(fmt.Sprintf("[%s]: %s\n", time.Now().Format("2006-01-02 15:04:05"), in)))
}
func (rb *RingBuf) WriteError(err error) (int, error) {
return rb.Write([]byte(fmt.Sprintf("[%s]: ⚠️ %s\n", time.Now().Format("2006-01-02 15:04:05"), err.Error())))
}
// Write writes all data from input buf to RingBuf, overriding looped data
func (rb *RingBuf) Write(buf []byte) (int, error) {
rb.Lock()