Skip to content

Commit

Permalink
upgrade logger
Browse files Browse the repository at this point in the history
  • Loading branch information
koyeo committed Aug 29, 2023
1 parent c949220 commit d113332
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions log.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ type EventLogger interface {
StandardLogger
}

// WithModule retrieves an event logger by name
func WithModule(module string) *Logger {
// NewLogger retrieves an logger by module name
func NewLogger(module string) *Logger {
if len(module) == 0 {
setuplog := getLogger("setup-logger")
setuplog.Error("Missing name parameter")
Expand Down
2 changes: 1 addition & 1 deletion log_level_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
func TestLogLevel(t *testing.T) {
const subsystem = "log-level-test"
SetupLogging(configFromEnv())
logger := WithModule(subsystem)
logger := NewLogger(subsystem)
reader := NewPipeReader()
done := make(chan struct{})
go func() {
Expand Down
6 changes: 3 additions & 3 deletions logbench_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
// Otherwise you test how fast your terminal can print.

func BenchmarkSimpleInfo(b *testing.B) {
l := WithModule("bench")
l := NewLogger("bench")
err := SetLogLevel("bench", "info")
if err != nil {
b.Fatal(err)
Expand All @@ -27,7 +27,7 @@ func BenchmarkSimpleInfo(b *testing.B) {
var logString = "String, IDK what to write, let's punch a keyboard. jkdlsjklfdjfklsjfklsdjaflkdjfkdjsfkldjsfkdjklfjdslfjakdfjioerjieofjofdnvonoijdfneslkffjsdfljadljfdjkfjkf"

func BenchmarkFormatInfo(b *testing.B) {
l := WithModule("bench")
l := NewLogger("bench")
err := SetLogLevel("bench", "info")
if err != nil {
b.Fatal(err)
Expand All @@ -41,7 +41,7 @@ func BenchmarkFormatInfo(b *testing.B) {
}

func BenchmarkFormatInfoMulti(b *testing.B) {
l := WithModule("bench")
l := NewLogger("bench")
err := SetLogLevel("bench", "info")
if err != nil {
b.Fatal(err)
Expand Down

0 comments on commit d113332

Please sign in to comment.