Comments (4)
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 [Moved to #15]\u0026
, but the formatter for terminal use doesn't need to escape these sequences. It can print them exactly as they are, I mean &
.
from log.
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.
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.
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
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 log.