From the course: Node.js: Debugging and Performance Tuning

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Why and what should I log?

Why and what should I log?

From the course: Node.js: Debugging and Performance Tuning

Start my 1-month free trial

Why and what should I log?

- [Narrator] What is a log? No, not the wood kind. A log is a record of events and messages between systems. They're used to understand what's happening on a system and define problems. Sounds like a great idea. Let's see how our rock, paper, scissors game logs. Open up Visual Studio Code, then the terminal. Let's take a look at our log files. Type PM2 space logs and press Enter. Well, that's underwhelming. In fact, other than start up messages from PM2, there aren't any logs. Let's open up a browser and arrange the window so we can see both. Great, let's start a game. Navigate to local host port 5000 and then click Start New. Make a choice. Awesome. Over on the left, what's going on on our log files? Well, nothing. That's not particularly useful. Alright, let's trigger an error. Instead of games one, let's go to games asdf. Now what's in the log? An error, now we're getting somewhere, or are we? Looking at this error, can you tell me how to make this error happen again? Well, there's…

Contents