![]() Generally speaking, Node.js is responsible for building Gatsby pages and therefore its built-in objects like console can be used at build time. To read more about Gatsby’s build process, check out the differences between build and runtime. There you might notice that args contains a lower-cased node variable. This works similar to how you might be used to in the browser.Īdding a console.log statement in the sample from above will print the variable into your terminal. One of the fastest ways to gain insight into Gatsby’s build process is using the console functionality built into Node.js. There is a bug in this code and using it will produce the error below: Debugging with Node.js’ built-in console In this guide you will learn how to debug some code using various techniques.Īs an example consider the following code snippet in a gatsby-node.js file: Stay in touch via Facebook and Twitter for upcoming tutorials.Gatsby’s build and develop steps run as a Node.js application which you can debug using standard tools for Node.js applications. This concludes our tutorial on IntelliJ Debug Configuration - Debugging Your Scala Application and I hope you've found it useful! To resume our application, simply click on the resume icon as shown below:.To the left hand side of the variables panel, you will see the call stack for our application.If you expand the this variable, you would see the _args variable which contains our command line arguments.You should then see our application starting but it will pause at our breakpoint from Step 5 above: Instead of right click and selecting the Debug menu item, you can click the debug icon on the top right corner in IntelliJ: You should have a red dot as shown above which represents our breakpoint on the line: println(args.mkString(", ")).To do this, we add a breakpoint by left click on the sliver to the left hand side of the line where we would like IntelliJ to pause our application: Suppose we wanted to debug and pause our application to visually inspect that our command line arguments from Step 4 above were actually contained inside the args argument. Next click the OK button to save and close the dialogue. The classpath of module defaults to our allaboutscala project which tells IntelliJ to look for our main class in this specific project.In our example, it is .tutorial_06.HelloWorldWIthArgumentsDebug A fully qualified path is simply the full package name where our file resides followed by the file name itself. The Main class textbox has the fully qualified path for our HelloWorldWithArgumentsDebug file.Our Debug configuration has a name which defaults to the name of our Scala file.In the program arguments textbox, add firstArgument secondArgument thirdArgument as shown below: This opens up the Run/Debug Configurations windows. Add command line arguments to the debug configurationįrom IntelliJ's Run menu, select Edit Configurations. Our command line arguments were empty! Well, that's expected since we did not pass any arguments when starting our HelloWorldWithArgumentsDebug Scala application.Ĥ.In the Console window, we can see our HelloWorldWithArgumentsDebug Scala application ran with the following output: Similar to the previous tutorial, right click anywhere in HelloWorldWithArgumentsDebug but instead of selecting the Run menu item, select Debug HelloWorldWithArgumentsDebug as follows: Similar to the previous tutorial, we can add the following print lines to show any command line arguments that are passed in when our Scala application starts: As explained in the previous tutorials, our HelloWorldWithArgumentsDebug application extends the A pp trait and as such we do not have to manually write up the main function. ![]() Let us create a package named .tutorial_07 and also create a new Scala object named HelloWorldWithArgumentsDebug as follows: If you do not have IntelliJ installed or do not know how to create a package or Scala object, feel free to review the previous tutorials. ![]() ![]() Open IntelliJ and create a new package and Scala object In this tutorial, we will review in more detail the debug configurations that are made available in IntelliJ when we debug our Scala applications.ġ. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |