Remote Client Logging
A websocket bridge allowing persistent debug logging from client to server/local node instance
For AMD/RequireJS, It is still recommended that you add it as a script
source for easy removal with
$ sudo npm install -g rcl
$ rclRunning "rcl" taskinfo - socket.io started[2012-09-25 09:14:48.863] [DEBUG] rcl - Connected on port 8888
rcl.info"Hi, I am your app.";rcldebug"Foo is now : %s" 42;
Logs will show up in your console, rcl (if running), and any client connected to your rcl instance.
Include the client source file in your client application and you can use the following commands immediately
You can download it at raw.github.com/jsoverson/rcl/master/src/rcl.js or you can output the version that matches your npm install via
$ rcl rcl.js > path/for/rcl.js
rclserver = false; // || truerclclient = false; // || true
For console logging, the support is the native console's capabilities. Terminal and web client support use string-format syntax (mostly the same).
Both are designed to be run as part of a build chain, usually after concatenation and before minification.
grunt-preprocess to your package.json's dependencies hash, or run
$ npm install --save grunt-strip grunt-preprocess
Remember to load these tasks as part of your gruntfile
<!-- exclude --><!-- endexclude -->
preprocess :main :src : 'src/index.html'dest : 'build/index.html'
See grunt-preprocess for advanced configurations
strip :main :src : 'src/main.js'dest : 'build/main.built.js'nodes : 'rcl''console'
See grunt-strip for advanced configurations
You are programming in a language stretched beyond its design across environments spanning years of standards and are delivering your source code directly to the client to be run outside of your control.
It's hard but so, so awesome and you are a brilliant genius to have gotten this far.
At the base, RCL is just a websocket bridge to log from your browser to another client. It could be anything, but right now is something like a server, another browser tab, or a mobile device.
RCL aggregates and classifies your log messages so that they are configurable in verbosity, using log4js on the server side for more flexibility.
No, you will still get console messages in your browser.
Because logging will bloat your code, expose intent behind your logic, and be an extra burden on the client. But, that said, if production logging is important enough to you, then try it out and we'd love to hear how it works.
One avenue being considered is to have grunt-strip support removing properties of nodes so that only certain log levels can be removed.
RCL was initially written with grunt in mind and can be used as a grunt plugin in a task chain.
$ npm install rcl
gruntregisterTask'dev' 'server rcl watch';
rcl :port : 3000wait : true
Please visit the project page for documentation log4js-node
In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using [grunt][grunt].
Copyright (c) 2012 Jarrod Overson
Licensed under the MIT license.