Coder Social home page Coder Social logo

Comments (6)

pohly avatar pohly commented on June 26, 2024

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.

thockin avatar thockin commented on June 26, 2024

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.

spacewander avatar spacewander commented on June 26, 2024

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.

spacewander avatar spacewander commented on June 26, 2024

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.

pohly avatar pohly commented on June 26, 2024

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.

spacewander avatar spacewander commented on June 26, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.