Comments (6)
Do you see an advantage in using funcr compared to some other backend (like zapr, which you already mentioned)? I'm not sure how much further changes will be done (or accepted) there.
Note that as of 1.3.0, you can also use slog backends, so if you are on Go 1.21 and worried about additional dependencies, then you can configure the log/slog JSON handler as backend for logr.
from logr.
I don't think one is too bad for funcr, and I would probably accept it as a PR. Something @pohly said without saying - funcr doesn't currently support slog, whereas slog.JSONHandler
can be used as a logr backend. I would also be OK to make funcr support slog better, but I have not looked at doing that.
from logr.
Do you see an advantage in using funcr compared to some other backend (like zapr, which you already mentioned)? I'm not sure how much further changes will be done (or accepted) there.
Note that as of 1.3.0, you can also use slog backends, so if you are on Go 1.21 and worried about additional dependencies, then you can configure the log/slog JSON handler as backend for logr.
In fact, I only use the Formatter
from func
. I am building a framework upon the Go extension of Envoy. The formatted string will be written to Envoy's log by calling Envoy's log API.
If I use zapr or slog, there will be two headers for each log: one from Envoy, the other from Go logger. Therefore I choose to build a logger from scratch.
from logr.
I don't think one is too bad for funcr, and I would probably accept it as a PR. Something @pohly said without saying - funcr doesn't currently support slog, whereas
slog.JSONHandler
can be used as a logr backend. I would also be OK to make funcr support slog better, but I have not looked at doing that.
Great! I will give it a try when I have free time.
from logr.
In fact, I only use the Formatter from func.
There are similar building blocks for slog - see https://github.com/golang/go/wiki/Resources-for-slog. But enhancing funcr might be simpler.
from logr.
In fact, I only use the Formatter from func.
There are similar building blocks for slog - see https://github.com/golang/go/wiki/Resources-for-slog. But enhancing funcr might be simpler.
@pohly
Thanks for pointing out that! I am using Go 1.20 so slog is not available for now, but I will investigate it once we upgrade the Go version.
from logr.
Related Issues (20)
- Why use WithName() HOT 7
- Add OpenSSF Scorecard workflow HOT 2
- Hash-pin workflow dependencies
- add support for slog.LogValuer
- Consider changing how keys are namespaced
- Consider a "group" construct to match slog
- Consider allowing timestamp to be passed into LogSink
- Consider allowing PC to be passed into Handler HOT 3
- Bump min Go version to at least 18? HOT 1
- TODO: Write a nice doc on logr <-> slog
- Enabled + stack unwinding HOT 7
- contextual logging for slog HOT 31
- TODO circa Go 1.24: Remove non-slog code and consolidate files
- Cut a new release (v1.4.0?) HOT 7
- Typesafe API HOT 4
- Unable to print Warn Logs when using logr/zapr HOT 5
- Metrics for logged messages HOT 5
- Methods to Interact With Sink Attributes HOT 3
- funcr: slog output omits intermediate groups HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from logr.