where to see console.log from api
I am doing a console.log() in my api i defined in my wasp but i cant see it anywhere, where do i see the log?
5 Replies
Hi @Sven. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
The console.log() statements from your server-side code, including your API endpoints, will be visible in the terminal where you ran the
wasp start
command. This is the standard output for server-side logging in a Wasp application.
For example, if you have a console.log() in your server function like this:
The output of console.log(req.body)
will be displayed in the terminal where you ran wasp start
.
If you need more detailed logs or debug messages, there isn't a built-in way in Wasp to do this yet. However, you can follow the progress of this feature request on this GitHub issue (https://github.com/wasp-lang/wasp/issues/73).
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------
Sorry @Sven, I seem to be having a bit of trouble. Don't worry though, I've pinged my support and they will try to fix me up! :technologist:
Perhaps try again in 15mins?@kapa.ai i only see thesse:
[ Server ] POST /operations/store-session-id 200 13.383 ms - 562
[ Server ] GET /auth/me 304 11.830 ms - -
[ Server ] GET /auth/me 304 12.056 ms - -
[ Server ] GET /auth/me 304 35.724 ms - -
Let me check the knowledge base for you. One moment! :books:
----------------------
The logs you are seeing are HTTP request logs, which are automatically generated by the server for each incoming request. They show the HTTP method (GET, POST, etc.), the request path, the response status code, the time it took to process the request, and the size of the response.
If you have added
console.log()
statements in your server-side code and they are not showing up in the logs, it could be due to a few reasons:
1. The code containing the console.log()
is not being executed. Make sure the function or route containing the console.log()
is actually being called.
2. There might be an error occurring before the console.log()
statement, causing the function to exit prematurely. Check for any error messages in the logs.
3. If you're using console.log()
inside a promise or async function, make sure the promise is being resolved. Unresolved promises can cause console.log()
statements to not be executed.
If you're still having trouble, you might want to consider using a more advanced logging library that provides more control over log levels and output formatting. However, this would involve modifying the generated server code, which is not officially supported by Wasp at the moment.
For more detailed debugging, you can follow the progress of this feature request on this GitHub issue (https://github.com/wasp-lang/wasp/issues/73).
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------
Sorry @Sven, I seem to be having a bit of trouble. Don't worry though, I've pinged my support and they will try to fix me up! :technologist:
Perhaps try again in 15mins?We are missing some context to be able to help. Please share your API code + Wasp file bits so we can see what you tried to do.
this was mainly for the bot to answer ahha
sorry
ended up not even running the api code