samber / slog-zap Goto Github PK
View Code? Open in Web Editor NEW๐จ slog: Zap handler
Home Page: https://pkg.go.dev/github.com/samber/slog-zap/v2
License: MIT License
๐จ slog: Zap handler
Home Page: https://pkg.go.dev/github.com/samber/slog-zap/v2
License: MIT License
By default, zap outputs to the logs the place where the logger was called from, but due to the fact that it is called from the internal handler, it outputs it incorrectly (not actual call location, but in internal handler).
e.g. output from readme example:
2024-01-08T12:46:03.534+0300 INFO [email protected]/handler.go:65 caramba! {"query.duration": "1s", "error": {"error":"could not count users","kind":"*errors.errorString","stack":null}
I know that you can set AddSource to true and get the same thing in additional argument, but I'm wondering if there is a way to fix or configure the output of call location for the default logger?
Currently, zap builds its own stacktrace and puts it in a string. It prevents us from playing with it and moving the initial frame to the slog logger call (instead of zap logger call).
We should write a stacktrace by ourselves. See the job done at https://github.com/samber/oops
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.