Skip to content

Commit

Permalink
fix: add logs methods (#311)
Browse files Browse the repository at this point in the history
* fix: add log methods

* delete some method
  • Loading branch information
Malyue authored Jan 12, 2024
1 parent 7847b1f commit e4c6c25
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
6 changes: 6 additions & 0 deletions base/logs/logrusx/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
package logrusx

import (
"io"

"github.com/sirupsen/logrus"

"github.com/erda-project/erda-infra/base/logs"
Expand Down Expand Up @@ -59,6 +61,10 @@ func (l *Logger) SetLevel(lvl string) error {
return nil
}

func (l *Logger) SetOutput(output io.Writer) {
l.Logger.SetOutput(output)
}

func processOptions(logr *logrus.Logger, logger *Logger, opt interface{}) {
switch val := opt.(type) {
case setNameOption:
Expand Down
5 changes: 5 additions & 0 deletions base/logs/logs.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@

package logs

import (
"io"
)

// Logger .
type Logger interface {
Sub(name string) Logger
Expand All @@ -32,4 +36,5 @@ type Logger interface {
Fatalf(template string, args ...interface{})

SetLevel(lvl string) error
SetOutput(output io.Writer)
}

0 comments on commit e4c6c25

Please sign in to comment.