bun
bun copied to clipboard
Don't log `[0.02ms] ".env"` messages by default, have it be opt in
What is the problem this feature would solve?
I love using bun for writing scripts etc. but it's annoying having to see the [0.02ms] ".env"
message after every time you run the script as it lets you know it sourced .env
.

This is great for the first time users as it can be nice to know but this can just be in the docs and users can be aware that bun will source .env
It would be nice if the default behaviour of bun would be not logging this message every time.
Thank you.
What is the feature you are proposing to solve the problem?
By default, not log [0.02ms] ".env"
message.
What alternatives have you considered?
I considered adding —logLevel=silent
flag as per Discord message but that didn't seem to work. And even if it did, it would be annoying having to prepend it to all my scripts. 😞
By default not logging sourcing messages, thus requiring explicit flag when given messages are wanted ?
Yes correct, that would be perfect for me at least. Hope Bun devs agree too.
Was told in Discord that this was intentional to know which .env
got loaded. Perhaps it was .env.production
.
To me that's a non common cause for problems but still.
At least if you keep it, make it so it just says .env loaded
instead of [0.02ms] ".env"
with sometimes changing numbers. Assuming this doesn't impact bun's performance having to change this log, it does run every time you have bun code with .env
It's very distracting see it in in output especially when you reload output to run on file change.
Also hope --silent
gets added to at least resolve the issue another way.
Thank you.
The team talked about this and agreed to remove this by default, but log it when --logLevel=verbose
. We'll make this change soon.
I think I can take care of it. I'll see what I can do
What is the status of this?
This can be silenced with logLevel = "error"
in bunfig.toml
We should move the log level of .env
to debug
in a future release
This was changed as of Bun v1.0.7, and Bun no longer logs ".env" by default.