-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #292 from strideynet/strideynet/slog
Zap -> Slog
- Loading branch information
Showing
26 changed files
with
231 additions
and
197 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package bfflog | ||
|
||
import ( | ||
"fmt" | ||
"log/slog" | ||
) | ||
|
||
func Err(e error) slog.Attr { | ||
return slog.String("error", e.Error()) | ||
} | ||
|
||
func Component(c string) slog.Attr { | ||
return slog.String("component", c) | ||
} | ||
|
||
func ActorDID(did string) slog.Attr { | ||
return slog.String("actor_did", did) | ||
} | ||
|
||
func ChildLogger(parent *slog.Logger, component string) *slog.Logger { | ||
return parent.With(slog.String("component", component)) | ||
} | ||
|
||
type PyroscopeSlogAdapter struct { | ||
Slog *slog.Logger | ||
} | ||
|
||
func (p *PyroscopeSlogAdapter) Infof(a string, b ...interface{}) { | ||
p.Slog.Info(fmt.Sprintf(a, b...)) | ||
} | ||
|
||
func (p *PyroscopeSlogAdapter) Debugf(a string, b ...interface{}) { | ||
p.Slog.Debug(fmt.Sprintf(a, b...)) | ||
} | ||
|
||
func (p *PyroscopeSlogAdapter) Errorf(a string, b ...interface{}) { | ||
p.Slog.Error(fmt.Sprintf(a, b...)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.