Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use stderr instead console.log #860

Closed
pelikhan opened this issue Apr 2, 2025 · 4 comments
Closed

use stderr instead console.log #860

pelikhan opened this issue Apr 2, 2025 · 4 comments

Comments

@pelikhan
Copy link

pelikhan commented Apr 2, 2025

It would be nice to avoid writing to console.log for debugging messages. Since MCP is using stdio, those messages generate errors in the protocols.

console.log(`[dotenv@${version}][INFO] ${message}`)

@motdotla
Copy link
Owner

motdotla commented Apr 2, 2025

Yeah this is a good point.

Have you seen dotenvx? It does this correctly.

Can you also speak to MCP more? Are you using dotenv as an MCP server somehow?

@pelikhan
Copy link
Author

pelikhan commented Apr 2, 2025

I will take a look at dotenvx.

Can you also speak to MCP more? Are you using dotenv as an MCP server somehow?

I have a node.js application that runs as an MCP. When using the stdio transport, any console.log output will be interpreted in the MCP transports which leads to some warnings about incorrect messages.

@motdotla
Copy link
Owner

motdotla commented Apr 7, 2025

i'm removing _log in the upcoming release. dotenv will just have _debug if debug: true is set.

meanwhile, dotenvx will support more controlled log levels:

Image

@motdotla motdotla closed this as completed Apr 7, 2025
@motdotla
Copy link
Owner

motdotla commented Apr 7, 2025

#862

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants