Code Monkey home page Code Monkey logo

Comments (1)

mtwichel avatar mtwichel commented on May 24, 2024 8

Hi there 👋 I agree this is a very important thing to add!

Personally, I would add a few more requirements that would be super nice to have:

  • Automatically logging uncaught errors in handlers in the correct format
  • Included middleware so it works "out of the box"

Because of these, I propose we use something like this repository that I set up to demonstrate how I think a dart_frog logger should work. You can check it out now - instructions are in the README (although I haven't published it to pub.dev yet so you'll have to add it as a git dependency for now).

A few reasons I think this is a great solution:

  1. It covers all the requirements laid out in the issue and my comment
  2. It exposes a simple typedef LogFormatter so that it's super easy to define your own log style if you'd like
  3. In a separate library, it includes a built-in support for Google Cloud Logging and a simple log format for local development
  4. It includes information like source location and stacktraces in the logs
  5. It uses very_good_analysis and has 100% coverage
  6. It only depends on shelf and not dart_frog so it works just as well with a raw shelf API

Lastly, I really think it's good to have the logger not built into the framework but instead as a separate package that can be added in through middleware.

The bold part of me proposes we migrate the existing repository to the /packages directory and rename it dart_frog_logger. I could also write a page on the docs site showing how to use it.

Let me know what you think 💙 I'm sure my package isn't perfect, but hopefully can at least share ideas and at most make this a super easy ticket to close 😎

from dart_frog.

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.