How many ways do you know ?
According to my little research, there are 3 different ways you can log messages in 𝗡𝗼𝗱𝗲𝗷𝘀.
1- 𝗰𝗼𝗻𝘀𝗼𝗹𝗲.𝗹𝗼𝗴: We all know this one and have used it extensively in Javascript. What people don't know that under the hood it actually uses 𝗽𝗿𝗼𝗰𝗲𝘀𝘀.𝘀𝘁𝗱𝗼𝘂𝘁.𝘄𝗿𝗶𝘁𝗲 with a line break.
2- 𝗽𝗿𝗼𝗰𝗲𝘀𝘀.𝘀𝘁𝗱𝗼𝘂𝘁.𝘄𝗿𝗶𝘁𝗲: Unlike the previous one, this outputs messages on the same line; so you're going to need to manually add like breaks.
3- 𝗳𝘀.𝘄𝗿𝗶𝘁𝗲𝗦𝘆𝗻𝗰: Also requires manual line breaks. Writes to 𝗽𝗿𝗼𝗰𝗲𝘀𝘀.𝘀𝘁𝗱𝗼𝘂𝘁.𝘄𝗿𝗶𝘁𝗲 like 𝗰𝗼𝗻𝘀𝗼𝗹𝗲.𝗹𝗼𝗴. This method though is a little unique. It takes an integer as the first argument, something called a 𝗳𝗶𝗹𝗲 𝗱𝗲𝗰𝗿𝘆𝗽𝘁𝗼𝗿. To make it write to the 𝘀𝘁𝗱𝗼𝘂𝘁, you have to set it to 1. I'll talk about it in my next post.
Did you learn something new today?
Like and share this post, and follow me for more!

Top comments (0)