Compare commits
No commits in common. "cf9d26cf6c712c90690c78af39553f3736ccfc75" and "1ad2b38afe019e48b5ffa110dd38b0b3fd21bcf8" have entirely different histories.
cf9d26cf6c
...
1ad2b38afe
5 changed files with 1570 additions and 3062 deletions
4603
.golangci.yml
4603
.golangci.yml
File diff suppressed because it is too large
Load diff
|
@ -2,9 +2,6 @@
|
|||
|
||||
## Unreleased
|
||||
|
||||
- The default formatter now prints timestamps with microseconds
|
||||
- Fix the use of syslog on darwin
|
||||
|
||||
## v0.4.1 (2022-06-03)
|
||||
|
||||
- Ensure all backends implement the interface `BACKEND`.
|
||||
|
|
|
@ -103,7 +103,7 @@ func GetLogger(name string) *Logger {
|
|||
|
||||
func defaultFormatter(r *Record) string {
|
||||
return fmt.Sprintf("%s [%-8s] %s: %s\n",
|
||||
r.Timestamp.Format("2006/01/02 15:04:05.999999"), r.Level.Name(), r.Logger,
|
||||
r.Timestamp.Format("2006/01/02 15:04:05"), r.Level.Name(), r.Logger,
|
||||
strings.TrimSpace(r.Message))
|
||||
}
|
||||
|
||||
|
|
|
@ -1,12 +1,6 @@
|
|||
package logging
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
import "testing"
|
||||
|
||||
func Test_LevelByName(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
@ -22,19 +16,3 @@ func Test_LevelByName(t *testing.T) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
func Test_defaultFormatter(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
r := &Record{
|
||||
Timestamp: time.Date(2000, 0o1, 0o2, 0o3, 0o4, 0o5, 123456789, time.Local),
|
||||
Level: Info,
|
||||
Logger: "my logger",
|
||||
Message: "my log line",
|
||||
}
|
||||
|
||||
got := defaultFormatter(r)
|
||||
want := fmt.Sprintf("2000/01/02 03:04:05.123456 [INFO ] my logger: my log line\n")
|
||||
|
||||
assert.Equal(t, want, got)
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue