darvaza-proxy / slog Goto Github PK
View Code? Open in Web Editor NEWstructured logger adaptors
Home Page: https://darvaza.org/slog
License: MIT License
structured logger adaptors
Home Page: https://darvaza.org/slog
License: MIT License
$ make test
▶ generating subproject rules
▶ test: root
? github.com/darvaza-proxy/slog [no test files]
? github.com/darvaza-proxy/slog/internal [no test files]
▶ test: logrus
? github.com/darvaza-proxy/slog/logrus [no test files]
▶ test: zap
? github.com/darvaza-proxy/slog/zap [no test files]
▶ test: zerolog
? github.com/darvaza-proxy/slog/zerolog [no test files]
▶ test: cblog
? github.com/darvaza-proxy/slog/cblog [no test files]
we need to find a way to test implementation and compliance of each adaptor we implement. currently reduced to zerolog
and cblog
, but also the *log.Logger
writer at the top level and the internal/
helpers
The following, using zlog.Fatal()
or zlog.Panic()
ends before the unreachable mark
package main
import (
"os"
"github.com/rs/zerolog"
)
func main() {
zlog := zerolog.New(zerolog.ConsoleWriter{
Out: os.Stderr,
})
zlog.Fatal().Msg("Fatal")
panic("unreachable")
}
�[90m<nil>�[0m �[1m�[31mFTL�[0m�[0m Fatal
Program exited.
but when using our wrapper, it doesn't.
package main
import (
"os"
slog "github.com/darvaza-proxy/slog/handlers/zerolog"
"github.com/rs/zerolog"
)
func main() {
zlog := zerolog.New(zerolog.ConsoleWriter{
Out: os.Stderr,
})
log := slog.New(&zlog)
log.Fatal().Print("Fatal")
panic("unreachable")
}
�[90m<nil>�[0m �[1m�[31mFTL�[0m�[0m Fatal
panic: unreachable
goroutine 1 [running]:
main.main()
/tmp/sandbox1363277814/prog.go:18 +0x15b
Program exited.
I was thinking if we should not have a backends folder for the log backends. Having them all in root seems a bit messy.
Something like
mkdir -p backends
git mv zerolog backends/zerolog
It will make #12 a bit easier to implement.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.