Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15407112
D21115.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
6 KB
Referenced Files
None
Subscribers
None
D21115.id.diff
View Options
diff --git a/src/applications/aphlict/management/PhabricatorAphlictManagementWorkflow.php b/src/applications/aphlict/management/PhabricatorAphlictManagementWorkflow.php
--- a/src/applications/aphlict/management/PhabricatorAphlictManagementWorkflow.php
+++ b/src/applications/aphlict/management/PhabricatorAphlictManagementWorkflow.php
@@ -550,11 +550,18 @@
}
private function getStartCommand(array $server_argv) {
+ $launch_argv = array();
+
+ if ($this->debug) {
+ $launch_argv[] = '--debug=1';
+ }
+
return csprintf(
- '%R %Ls -- %s %Ls',
+ '%R %Ls -- %s %Ls %Ls',
$this->getNodeBinary(),
$this->getNodeArgv(),
$this->getAphlictScriptPath(),
+ $launch_argv,
$server_argv);
}
diff --git a/support/aphlict/server/aphlict_server.js b/support/aphlict/server/aphlict_server.js
--- a/support/aphlict/server/aphlict_server.js
+++ b/support/aphlict/server/aphlict_server.js
@@ -9,6 +9,7 @@
function parse_command_line_arguments(argv) {
var args = {
test: false,
+ debug: false,
config: null
};
@@ -34,12 +35,16 @@
require('./lib/AphlictLog');
-var debug = new JX.AphlictLog()
- .addConsole(console);
+var debug = new JX.AphlictLog();
var args = parse_command_line_arguments(process.argv);
var config = parse_config(args);
+if (args.test || args.debug) {
+ debug.addConsole(console);
+ debug.setTrace(true);
+}
+
function set_exit_code(code) {
process.on('exit', function() {
process.exit(code);
diff --git a/support/aphlict/server/lib/AphlictAdminServer.js b/support/aphlict/server/lib/AphlictAdminServer.js
--- a/support/aphlict/server/lib/AphlictAdminServer.js
+++ b/support/aphlict/server/lib/AphlictAdminServer.js
@@ -4,7 +4,6 @@
require('./AphlictListenerList');
-var http = require('http');
var url = require('url');
JX.install('AphlictAdminServer', {
@@ -54,6 +53,17 @@
return this;
},
+ trace: function() {
+ var logger = this.getLogger();
+ if (!logger) {
+ return;
+ }
+
+ logger.trace.apply(logger, arguments);
+
+ return this;
+ },
+
listen: function() {
return this._server.listen.apply(this._server, arguments);
},
@@ -76,7 +86,7 @@
try {
var msg = JSON.parse(body);
- self.log(
+ self.trace(
'Received notification (' + instance + '): ' +
JSON.stringify(msg));
++self._messagesIn;
@@ -201,13 +211,13 @@
listener.writeMessage(message);
++this._messagesOut;
- this.log(
+ this.trace(
'<%s> Wrote Message',
listener.getDescription());
} catch (error) {
list.removeListener(listener);
- this.log(
+ this.trace(
'<%s> Write Error: %s',
listener.getDescription(),
error);
diff --git a/support/aphlict/server/lib/AphlictClientServer.js b/support/aphlict/server/lib/AphlictClientServer.js
--- a/support/aphlict/server/lib/AphlictClientServer.js
+++ b/support/aphlict/server/lib/AphlictClientServer.js
@@ -3,7 +3,6 @@
var JX = require('./javelin').JX;
require('./AphlictListenerList');
-require('./AphlictLog');
var url = require('url');
var util = require('util');
@@ -60,6 +59,17 @@
return this;
},
+ trace: function() {
+ var logger = this.getLogger();
+ if (!logger) {
+ return;
+ }
+
+ logger.trace.apply(logger, arguments);
+
+ return this;
+ },
+
_onrequest: function(request, response) {
// The websocket code upgrades connections before they get here, so
// this only handles normal HTTP connections. We just fail them with
@@ -104,17 +114,24 @@
var listener = self.getListenerList(instance).addListener(ws);
- function log() {
- self.log(
- util.format('<%s>', listener.getDescription()) +
+ function msg(argv) {
+ return util.format('<%s>', listener.getDescription()) +
' ' +
- util.format.apply(null, arguments));
+ util.format.apply(null, argv);
+ }
+
+ function log() {
+ self.log(msg(arguments));
}
- log('Connected from %s.', ws._socket.remoteAddress);
+ function trace() {
+ self.trace(msg(arguments));
+ }
+
+ trace('Connected from %s.', ws._socket.remoteAddress);
ws.on('message', function(data) {
- log('Received message: %s', data);
+ trace('Received message: %s', data);
var message;
try {
@@ -126,14 +143,14 @@
switch (message.command) {
case 'subscribe':
- log(
+ trace(
'Subscribed to: %s',
JSON.stringify(message.data));
listener.subscribe(message.data);
break;
case 'unsubscribe':
- log(
+ trace(
'Unsubscribed from: %s',
JSON.stringify(message.data));
listener.unsubscribe(message.data);
@@ -180,7 +197,7 @@
ws.on('close', function() {
self.getListenerList(instance).removeListener(listener);
- log('Disconnected.');
+ trace('Disconnected.');
});
});
diff --git a/support/aphlict/server/lib/AphlictLog.js b/support/aphlict/server/lib/AphlictLog.js
--- a/support/aphlict/server/lib/AphlictLog.js
+++ b/support/aphlict/server/lib/AphlictLog.js
@@ -14,6 +14,12 @@
members: {
_consoles: null,
_logs: null,
+ _trace: null,
+
+ setTrace: function(trace) {
+ this._trace = trace;
+ return this;
+ },
addConsole: function(console) {
this._consoles.push(console);
@@ -29,6 +35,14 @@
return this;
},
+ trace: function() {
+ if (!this._trace) {
+ return;
+ }
+
+ return this.log.apply(this, arguments);
+ },
+
log: function() {
var str = util.format.apply(null, arguments);
var date = new Date().toLocaleString();
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Mar 19, 3:48 PM (2 d, 5 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7228475
Default Alt Text
D21115.id.diff (6 KB)
Attached To
Mode
D21115: Reduce the verbosity of the "Aphlict" log
Attached
Detach File
Event Timeline
Log In to Comment