mirror of
https://github.com/EDCD/EDDN.git
synced 2025-04-20 10:37:38 +03:00
Add debug mode
This commit is contained in:
parent
8d150171e1
commit
8f0d063e79
@ -5,6 +5,9 @@
|
||||
$relayEDDN = 'tcp://eddn-relay.elite-markets.net:9500';
|
||||
$timeoutEDDN = 600000;
|
||||
|
||||
// Set false to listen to production stream
|
||||
$debugEDDN = true;
|
||||
|
||||
// Set to false if you do not want verbose logging
|
||||
$logVerboseFile = dirname(__FILE__) . '/Logs_Verbose_EDDN_%DATE%.htm';
|
||||
//$logVerboseFile = false;
|
||||
@ -15,11 +18,12 @@ $logJSONFile = dirname(__FILE__) . '/Logs_JSON_EDDN_%DATE%.log';
|
||||
|
||||
// A sample list of authorised softwares
|
||||
$authorisedSoftwares = array(
|
||||
"EDCE",
|
||||
"ED-TD.SPACE",
|
||||
"EliteOCR",
|
||||
"Maddavo's Market Share",
|
||||
"RegulatedNoise",
|
||||
"RegulatedNoise__DJ",
|
||||
"Maddavo's Market Share"
|
||||
"RegulatedNoise__DJ"
|
||||
);
|
||||
|
||||
// Used this to excludes yourself for example has you don't want to handle your own messages ^^
|
||||
@ -115,14 +119,14 @@ while (true)
|
||||
$converted = false;
|
||||
|
||||
// Handle commodity v1
|
||||
if($json['$schemaRef'] == 'http://schemas.elite-markets.net/eddn/commodity/1')
|
||||
if($json['$schemaRef'] == 'http://schemas.elite-markets.net/eddn/commodity/1' . (($debugEDDN === true) ? '/test' : ''))
|
||||
{
|
||||
echoLogJSON($message);
|
||||
echoLog('Receiving commodity-v1 message...');
|
||||
echoLog(' - Converting to v2...');
|
||||
|
||||
$temp = array();
|
||||
$temp['$schemaRef'] = 'http://schemas.elite-markets.net/eddn/commodity/2';
|
||||
$temp['$schemaRef'] = 'http://schemas.elite-markets.net/eddn/commodity/2' . (($debugEDDN === true) ? '/test' : '');
|
||||
$temp['header'] = $json['header'];
|
||||
|
||||
$temp['message'] = array();
|
||||
@ -160,7 +164,7 @@ while (true)
|
||||
|
||||
|
||||
// Handle commodity v2
|
||||
if($json['$schemaRef'] == 'http://schemas.elite-markets.net/eddn/commodity/2')
|
||||
if($json['$schemaRef'] == 'http://schemas.elite-markets.net/eddn/commodity/2' . (($debugEDDN === true) ? '/test' : ''))
|
||||
{
|
||||
if($converted === false)
|
||||
{
|
||||
|
@ -9,6 +9,9 @@ import sys, os, datetime, time
|
||||
__relayEDDN = 'tcp://eddn-relay.elite-markets.net:9500'
|
||||
__timeoutEDDN = 600000
|
||||
|
||||
# Set False to listen to production stream
|
||||
__debugEDDN = True;
|
||||
|
||||
# Set to False if you do not want verbose logging
|
||||
__logVerboseFile = os.path.dirname(__file__) + '/Logs_Verbose_EDDN_%DATE%.htm'
|
||||
#__logVerboseFile = False
|
||||
@ -19,11 +22,12 @@ __logJSONFile = os.path.dirname(__file__) + '/Logs_JSON_EDDN_%DATE%.lo
|
||||
|
||||
# A sample list of authorised softwares
|
||||
__authorisedSoftwares = [
|
||||
"EDCE",
|
||||
"ED-TD.SPACE",
|
||||
"EliteOCR",
|
||||
"Maddavo's Market Share",
|
||||
"RegulatedNoise",
|
||||
"RegulatedNoise__DJ",
|
||||
"Maddavo's Market Share"
|
||||
"RegulatedNoise__DJ"
|
||||
]
|
||||
|
||||
# Used this to excludes yourself for example has you don't want to handle your own messages ^^
|
||||
@ -106,13 +110,13 @@ def main():
|
||||
|
||||
|
||||
# Handle commodity v1
|
||||
if __json['$schemaRef'] == 'http://schemas.elite-markets.net/eddn/commodity/1':
|
||||
if __json['$schemaRef'] == 'http://schemas.elite-markets.net/eddn/commodity/1' + ('/test' if (__debugEDDN == True) else ''):
|
||||
echoLogJSON(__message)
|
||||
echoLog('Receiving commodity-v1 message...');
|
||||
echoLog(' - Converting to v2...');
|
||||
|
||||
__temp = {}
|
||||
__temp['$schemaRef'] = 'http://schemas.elite-markets.net/eddn/commodity/2'
|
||||
__temp['$schemaRef'] = 'http://schemas.elite-markets.net/eddn/commodity/2' + ('/test' if (__debugEDDN == True) else '')
|
||||
__temp['header'] = __json['header']
|
||||
|
||||
__temp['message'] = {}
|
||||
@ -148,7 +152,7 @@ def main():
|
||||
__converted = True
|
||||
|
||||
# Handle commodity v2
|
||||
if __json['$schemaRef'] == 'http://schemas.elite-markets.net/eddn/commodity/2':
|
||||
if __json['$schemaRef'] == 'http://schemas.elite-markets.net/eddn/commodity/2' + ('/test' if (__debugEDDN == True) else ''):
|
||||
if __converted == False:
|
||||
echoLogJSON(__message)
|
||||
echoLog('Receiving commodity-v2 message...')
|
||||
|
Loading…
x
Reference in New Issue
Block a user