bun icon indicating copy to clipboard operation
bun copied to clipboard

Don't log `[0.02ms] ".env"` messages by default, have it be opt in

Open nikitavoloboev opened this issue 2 years ago • 3 comments

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.

image

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. 😞

nikitavoloboev avatar Feb 21 '23 09:02 nikitavoloboev

By default not logging sourcing messages, thus requiring explicit flag when given messages are wanted ?

chrisAXZA avatar Feb 22 '23 10:02 chrisAXZA

Yes correct, that would be perfect for me at least. Hope Bun devs agree too.

nikitavoloboev avatar Feb 22 '23 10:02 nikitavoloboev

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.

nikitavoloboev avatar Feb 27 '23 12:02 nikitavoloboev

The team talked about this and agreed to remove this by default, but log it when --logLevel=verbose. We'll make this change soon.

Electroid avatar Mar 13 '23 22:03 Electroid

I think I can take care of it. I'll see what I can do

trnxdev avatar May 31 '23 00:05 trnxdev

What is the status of this?

simylein avatar Jul 29 '23 10:07 simylein

This can be silenced with logLevel = "error" in bunfig.toml

image

We should move the log level of .env to debug in a future release

Jarred-Sumner avatar Jul 29 '23 10:07 Jarred-Sumner

This was changed as of Bun v1.0.7, and Bun no longer logs ".env" by default.

Electroid avatar Oct 24 '23 22:10 Electroid