Skip to content

Commit

Permalink
update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
phuslu committed Apr 27, 2024
1 parent f7d1dc4 commit f22d8c2
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# phuslog - High performance structured logging
# phuslog - Fastest structured logging

[![godoc][godoc-img]][godoc]
[![goreport][report-img]][report]
Expand Down Expand Up @@ -272,7 +272,7 @@ func (l *Glog) Errorf(fmt string, a ...any) { l.Logger.Error().Msgf(fmt, a...) }

var glog = &Glog{log.Logger{
Level: log.InfoLevel,
Caller: 1,
Caller: 2,
TimeFormat: "0102 15:04:05.999999",
Writer: &log.ConsoleWriter{Formatter: func(w io.Writer, a *log.FormatterArgs) (int, error) {
return fmt.Fprintf(w, "%c%s %s %s] %s\n%s", a.Level[0]-32, a.Time, a.Goid, a.Caller, a.Message, a.Stack)
Expand Down Expand Up @@ -691,9 +691,9 @@ func main() {
}
```

### log/slog Adapter
### slog Adapter

Using wrapped loggers for log/slog. [![playground][play-slog-img]][play-slog]
Using wrapped loggers for slog. [![playground][play-slog-img]][play-slog]

```go
package main
Expand All @@ -705,18 +705,18 @@ import (
)

func main() {
slog.SetDefault((&log.Logger{
var logger *slog.Logger = (&log.Logger{
Level: log.InfoLevel,
TimeField: "date",
TimeFormat: "2006-01-02",
Caller: 1,
Context: log.NewContext(nil).Str("logger", "my_slog").Int("myid", 42).Value(),
}).Slog())
}).Slog()

slog.Debug("hello from slog Info")
slog.Info("hello from slog Info")
slog.Warn("hello from slog Warn")
slog.Error("hello from slog Error")
logger = logger.With("logger", "a_test_slog").With("everything", 42)

logger.Info("hello from slog Info")
logger.Warn("hello from slog Warn")
logger.Error("hello from slog Error")
}
```

Expand Down Expand Up @@ -1173,8 +1173,8 @@ This log is heavily inspired by [zerolog][zerolog], [glog][glog], [gjson][gjson]
[play-pretty-img]: https://img.shields.io/badge/playground-SCcXG33esvI-29BEB0?style=flat&logo=go
[play-pretty]: https://go.dev/play/p/SCcXG33esvI
[pretty-img]: https://user-images.githubusercontent.com/195836/101993218-cda82380-3cf3-11eb-9aa2-b8b1c832a72e.png
[play-glog-img]: https://img.shields.io/badge/playground-6pEThv3WO7W-29BEB0?style=flat&logo=go
[play-glog]: https://go.dev/play/p/6pEThv3WO7W
[play-glog-img]: https://img.shields.io/badge/playground-oxSyv3ra5W5-29BEB0?style=flat&logo=go
[play-glog]: https://go.dev/play/p/oxSyv3ra5W5
[play-logfmt-img]: https://img.shields.io/badge/playground-7aSa--rxHmqw-29BEB0?style=flat&logo=go
[play-logfmt]: https://go.dev/play/p/7aSa-rxHmqw
[play-context-img]: https://img.shields.io/badge/playground-oAVAo302faf-29BEB0?style=flat&logo=go
Expand All @@ -1185,8 +1185,8 @@ This log is heavily inspired by [zerolog][zerolog], [glog][glog], [gjson][gjson]
[play-marshal]: https://go.dev/play/p/SoQdwQOaQR2
[play-stdlog]: https://go.dev/play/p/DnKyE92LEEm
[play-stdlog-img]: https://img.shields.io/badge/playground-DnKyE92LEEm-29BEB0?style=flat&logo=go
[play-slog]: https://go.dev/play/p/ez_yIPOXBQF
[play-slog-img]: https://img.shields.io/badge/playground-ez__yIPOXBQF-29BEB0?style=flat&logo=go
[play-slog]: https://go.dev/play/p/JW3Ts6FcB40
[play-slog-img]: https://img.shields.io/badge/playground-JW3Ts6FcB40-29BEB0?style=flat&logo=go
[benchmark]: https://github.com/phuslu/log/actions?query=workflow%3Abenchmark
[zerolog]: https://github.com/rs/zerolog
[glog]: https://github.com/golang/glog
Expand Down

0 comments on commit f22d8c2

Please sign in to comment.