Home > Web Front-end > JS Tutorial > Auxiliary tool for debugging Node.JS (NodeWatcher)_javascript skills

Auxiliary tool for debugging Node.JS (NodeWatcher)_javascript skills

WBOY
Release: 2016-05-16 17:57:37
Original
1229 people have browsed it

It seems that fs.watchfile is not supported on the Windows platform. I don’t want to use IIS NODE, so I spent some time writing a small tool to help debugging.
This tool can do:
Monitor the main js file Changes to files related to all subdirectories. Restart the Node process after changes
can output the log to this tool for easy viewing in the browser.
Usage:
NodeWatcher.exe main .js
All parameters:

Copy code The code is as follows:

NodeWatcher.exe Main JS program [Other optional parameters]
The main JS program must be specified. Equivalent to node main js program
-r: [true | false ] Automatically restart when an error occurs (node ​​process exits).
Example: NodeWatcher.exe -r false
-e: Which files with suffix names are to be monitored in the monitored directory. The default is js and node
Example: NodeWatcher.exe -w lib -e js -e node -e json -e xml -e config
-?:
-help: Display help document

The log output can be viewed on the web page
http://localhost:2012/
As shown below:

image

Node.JS outputs logs to the tool. You can use the console.log series of statements or call the methods provided by the tool.
Methods provided by the tool:
1 Download http://localhost:2012/logger.js to the root directory of the project
2 Reference require(“./logger.js”)
3 Call:
logger.log (….)
logger.error()
logger.info()
logger.warn()
logger.exception(e)
The parameter can be a string or an object, if Object, then its first-level attributes will be output.


Installation:
No need to install, but you need to have .Net framework on your computer. I compiled it with 2.0. Replace NodeWatcher.exe Download it and put it in the directory and you can use it.
Download address: NodeWatcher_jb51.net.rar
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template