How to capture console. log () Output in JS
We know that console. log () can output information to the debugger for developers to view. But what if we want to get the output result of console.
When debugging js, we can use alert to display information and Debug programs. The alert pop-up window will interrupt the program. If you want to display information in a loop, you will be exhausted by clicking close window. In addition, the alert Display object is always displayed as [object]. Although the self-written log can display some object information, many functions do not support the
=1402286804314, pid=80481Finally, the log method provides the same string fill method as Util.format, for example:Winston.log (' info ', ' test message%d ', 123);The transfer (transporters) Winston can be configured by the parameters of the constructor, or through an exposed interface method, on GitHub with a detailed descriptive narrative.Configuration is primarily related to transport, by default, the transfer uses the
node. js Log Frame selection comparison: WinstonbunyanBunyan (by Trent Mick) is another log framework worth considering, with a slightly different approach to structuring, and machine readability being treated with emphasis.As a result, Bunyan per row of log records is actua
One of our games is ready to go online, and for the last few weeks we've been preparing for the launch. Due to the long development cycle of this game, the server is using node. JS Development, several of which are older and ready to upgrade before going online.The upgrade includes the CRC and Async 2 packets, did not expect the 2 common package API has been changed, resulting in a bug in the game server, s
);
// Output a String to the console once the server starts up, lew.us know everything// Starts up correctlyConsole. log ("Random Number Generator Running ...");
Start the application
Put the above code into a file named "random. js. To start the application and run it (to create an HTTP server and listen to connections on port 80), enter the following command
.10jqka.com.cn', 'www .duokan.com ']; function fetchPage (url) {var start = new Date (); http. get ({host: url}, function (res) {console. log ("Got response from:" + url); console. log ("Request took:", new Date ()-start, "ms") ;}) ;}for (var I = 0; I
Name it, node.
A chance, open Baidu when pressed the F12, and then see the console inside the output of Baidu recruitment ads, feeling pretty handsome, and then have this blog.
Since you can do this in the console output information, then debug JS after the time can not save a lot of trouble! Avoid fraught, intentionally using the for (var i in
This article analyzes and explains node through several examples. the use of require in js is very detailed. Here we recommend that you provide a very clear description in the code comments. Here we will not talk nonsense about it. We will provide the Code directly:
The Code is as follows:
/* In node, you can use the require () function to load modules.* The r
. conf file and add the following
Nameserver 8.8.8.8Nameserver 8.8.4.4Save and close.
Step end. Test whether node. js can be run
Now that you have completed the setup, but you don't know if it can run correctly, let's write an example file to test it.
Create example. js in the C: \ cygwin \ directory
InputVaR HTTP = require ('http ');
HTTP. createserve
miserable thing it would be if you use alert, because alert blocks the thread from running, you don't click the OK button on the alert box and the next alert will not appear.Below we use Console.log to replace, feel its charm.Look at the above picture, is not aware of the strength of the log, the following we look at the console inside the specific provides what methods can be used in our normal debugging.
miserable thing it would be if you use alert, because alert blocks the thread from running, you don't click the OK button on the alert box and the next alert will not appear.Below we use Console.log to replace, feel its charm.Look at the above picture, is not aware of the strength of the log, the following we look at the console inside the specific provides what methods can be used in our normal debugging.
miserable thing it would be if you use alert, because alert blocks the thread from running, you don't click the OK button on the alert box and the next alert will not appear.Below we use Console.log to replace, feel its charm.Look at the above picture, is not aware of the strength of the log, the following we look at the console inside the specific provides what methods can be used in our normal debugging.
miserable thing it would be if you use alert, because alert blocks the thread from running, you don't click the OK button on the alert box and the next alert will not appear.Below we use Console.log to replace, feel its charm.Look at the above picture, is not aware of the strength of the log, the following we look at the console inside the specific provides what methods can be used in our normal debugging.
In node. js, q. js is used to implement api promise. node. jsq. js
About what is promise and promise solution is what problem, please experience node callback asynchronous encoding method, along with the step http://wiki.commonjs.
suffix can be omitted; start with "/" with an absolute path to load, ". /"starts ".. /"starts ". /"indicates files under the same directory,
The file suffix mentioned above can be omitted. The priority js file to be loaded by Nodejs is> json File> node File
Create a custom Module
Take a counter as an Example
The Code is as follows:
Var outputVal = 0; // output valueVar increment = 1; // incremental/* Se
Introduced:JS Console you can be in Firefox firedbug or IE and Google F12 debug mode to see, these mainstream browser debugging mode control can output some information, Some of your JS code tests can be entered directly in the console window and then run to view the results, save the deployment project and refresh the page time; Of course, you have some special
list box, enter "Run Nodejs" in the edit Item name box above, and clickAdd/ModifyButton. Final result reference:
ClickOKButton to close the dialog box.
Finally, let's addRun NodejsCommand to associate a shortcut key. ClickSettings-> Shortcut cut Mapper...In the displayed Shortcut mapper dialog box, selectPlugin commandsClick this button to switch to the command from the plug-in, find our Run Nodejs in the list, and double-click the left mouse button (or clickModifyIn the pop-up dialog box, edi
This article analyzes and explains node through several examples. the use of require in js is very detailed. Here we recommend that you provide a very clear description in the code comments. Here we will not talk nonsense about it. We will provide the Code directly:
The Code is as follows:
/* In node, you can use the require () function to load modules.* The r
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.