Skip to content

Commit

Permalink
logic change
Browse files Browse the repository at this point in the history
  • Loading branch information
phuhao00 committed Mar 26, 2023
1 parent 1b2b513 commit dcb4e83
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 31 deletions.
8 changes: 8 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions .idea/spoor.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 1 addition & 31 deletions spoor.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package spoor

import (
"fmt"
"io"
"log"
)
Expand Down Expand Up @@ -40,36 +39,7 @@ func NewSpoor(cfgLevel Level, prefix string, flag int, opts ...Option) *Spoor {
return s
}

//DebugF Log line format: [IWEF]mmdd hh:mm:ss.uuuuuu threadid file:line] msg
func (s *Spoor) DebugF(f string, args ...interface{}) {
if s.checkLevel(DEBUG) {
return
}
s.l.Output(2, fmt.Sprintf(DEBUG.String()+" "+f, args...))
}

func (s *Spoor) ErrorF(f string, args ...interface{}) {
if s.checkLevel(ERROR) {
return
}
s.l.Output(2, fmt.Sprintf(ERROR.String()+" "+f, args...))
}

func (s *Spoor) InfoF(f string, args ...interface{}) {
if s.checkLevel(INFO) {
return
}
s.l.Output(2, fmt.Sprintf(INFO.String()+" "+f, args...))
}

func (s *Spoor) FatalF(f string, args ...interface{}) {
if s.checkLevel(FATAL) {
return
}
s.l.Output(2, fmt.Sprintf(FATAL.String()+" "+f, args...))
}

func (l *Spoor) checkLevel(level Level) bool {
func (l *Spoor) CheckLevel(level Level) bool {
if level >= l.cfgLevel {
return false
}
Expand Down

0 comments on commit dcb4e83

Please sign in to comment.