|
|
@ -1,12 +1,12 @@
|
|
|
|
package logx
|
|
|
|
package logx
|
|
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
import (
|
|
|
|
|
|
|
|
"bytes"
|
|
|
|
"encoding/json"
|
|
|
|
"encoding/json"
|
|
|
|
"fmt"
|
|
|
|
"fmt"
|
|
|
|
"io"
|
|
|
|
"io"
|
|
|
|
"log"
|
|
|
|
"log"
|
|
|
|
"path"
|
|
|
|
"path"
|
|
|
|
"strings"
|
|
|
|
|
|
|
|
"sync"
|
|
|
|
"sync"
|
|
|
|
"sync/atomic"
|
|
|
|
"sync/atomic"
|
|
|
|
|
|
|
|
|
|
|
@ -329,7 +329,7 @@ func writePlainAny(writer io.Writer, level string, val interface{}, fields ...st
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func writePlainText(writer io.Writer, level, msg string, fields ...string) {
|
|
|
|
func writePlainText(writer io.Writer, level, msg string, fields ...string) {
|
|
|
|
var buf strings.Builder
|
|
|
|
var buf bytes.Buffer
|
|
|
|
buf.WriteString(getTimestamp())
|
|
|
|
buf.WriteString(getTimestamp())
|
|
|
|
buf.WriteByte(plainEncodingSep)
|
|
|
|
buf.WriteByte(plainEncodingSep)
|
|
|
|
buf.WriteString(level)
|
|
|
|
buf.WriteString(level)
|
|
|
@ -345,13 +345,14 @@ func writePlainText(writer io.Writer, level, msg string, fields ...string) {
|
|
|
|
return
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if _, err := fmt.Fprint(writer, buf.String()); err != nil {
|
|
|
|
if _, err := writer.Write(buf.Bytes()); err != nil {
|
|
|
|
log.Println(err.Error())
|
|
|
|
log.Println(err.Error())
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func writePlainValue(writer io.Writer, level string, val interface{}, fields ...string) {
|
|
|
|
func writePlainValue(writer io.Writer, level string, val interface{}, fields ...string) {
|
|
|
|
var buf strings.Builder
|
|
|
|
var buf bytes.Buffer
|
|
|
|
buf.WriteString(getTimestamp())
|
|
|
|
buf.WriteString(getTimestamp())
|
|
|
|
buf.WriteByte(plainEncodingSep)
|
|
|
|
buf.WriteByte(plainEncodingSep)
|
|
|
|
buf.WriteString(level)
|
|
|
|
buf.WriteString(level)
|
|
|
@ -371,7 +372,7 @@ func writePlainValue(writer io.Writer, level string, val interface{}, fields ...
|
|
|
|
return
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if _, err := fmt.Fprint(writer, buf.String()); err != nil {
|
|
|
|
if _, err := writer.Write(buf.Bytes()); err != nil {
|
|
|
|
log.Println(err.Error())
|
|
|
|
log.Println(err.Error())
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|