Giter VIP home page Giter VIP logo

Comments (4)

jabielecki avatar jabielecki commented on July 18, 2024 1

I'm thinking to leave the environment variable to the caller, and instead create a setup func. A snippet for users would be like:

if os.GetEnv("MY_APP_ENV") == "development" {
  log.SetFormatter(log.FormatForTerminalWithEmoji)
}

The default would be log.FormatForGoogle if that naming makes sense. It's a func so user could bring their own as well.

And I don't think that the logging library is responsible for cleaning \u0026, but the formatter for terminal use doesn't need to escape these sequences. It can print them exactly as they are, I mean &. [Moved to #15]

from log.

jabielecki avatar jabielecki commented on July 18, 2024

I would welcome such pull request, emojis are definitely in scope. 🙂 (Sorry for the delayed response @steebchen , in future it'll be better. As of now I'm back at it!)

I don't think heuristics over well-known env vars would work predictably - the lib is not specific to Cloud Run only.

from log.

steebchen avatar steebchen commented on July 18, 2024

Fair enough, I'm not sure how one could detect a local environment. Maybe via a custom env var 'ENV=development', which you could just set in your dev scripts if you wanted to.

from log.

steebchen avatar steebchen commented on July 18, 2024

I'm thinking to leave the environment variable to the caller, and instead create a setup func.

Ah, that is a smart idea. I like it!

from log.

Related Issues (6)

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.