Permalink
Browse files

Changes, bring inline with blog post

  • Loading branch information...
1 parent ce84ad6 commit 3d87dd2045aeee95785ee0a0094a209d3ce1565c Will Larson committed Jan 31, 2010
Showing with 7 additions and 7 deletions.
  1. +7 −7 log_watcher.js
View
@@ -1,23 +1,23 @@
var sys = require("sys"),
- http = require("http");
+ http = require("http"),
+ file = process.ARGV[3],
+ hostname = (process.ARGV[4]) ? process.ARGV[4] : "localhost",
+ port = (process.ARGV[5]) ? parseInt(process.ARGV[5]) : 8000,
+ log_server = http.createClient(port, hostname);
-var file = process.ARGV[3];
-var hostname = (process.ARGV[4]) ? process.ARGV[4] : "localhost";
-var port = (process.ARGV[5]) ? parseInt(process.ARGV[5]) : 8000;
-var log_server = http.createClient(port, hostname);
sys.puts("sending logs to " + hostname + ":" + port);
var send_log = function(msg) {
var req = log_server.request("POST", "/", {"Content-Length":msg.length});
- req.sendBody(msg, encoding="ascii")
+ req.sendBody(msg, encoding="ascii");
req.finish();
}
var monitor_file = function(filename) {
sys.puts("monitor_file: monitoring " + filename);
var cmd = process.createChildProcess("tail", ["-F", filename]);
cmd.addListener("output", function(data) {
- sys.puts("output: sending (" + data.length + ")");
+ sys.puts("output: sending (" + data.length + ")");
send_log(data);
});
};

0 comments on commit 3d87dd2

Please sign in to comment.