mirror of
https://github.com/EDCD/EDDN.git
synced 2025-06-06 02:13:24 +03:00
Fix logFile date not updating
- Fix logFile name - Add inline example in log
This commit is contained in:
parent
bf952a736a
commit
583e291143
1
.gitignore
vendored
1
.gitignore
vendored
@ -52,3 +52,4 @@ docs/_build/
|
|||||||
|
|
||||||
# PyBuilder
|
# PyBuilder
|
||||||
target/
|
target/
|
||||||
|
*.htm
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
* Configuration
|
* Configuration
|
||||||
*/
|
*/
|
||||||
$relayEDDN = 'tcp://eddn-relay.elite-markets.net:9500';
|
$relayEDDN = 'tcp://eddn-relay.elite-markets.net:9500';
|
||||||
$logFile = dirname(__FILE__) . '/Logs_EDDN_' . date('Y-m-d') . '.htm';
|
$logFile = dirname(__FILE__) . '/Logs_EDDN_%DATE%.htm';
|
||||||
|
|
||||||
// A sample list of authorised softwares
|
// A sample list of authorised softwares
|
||||||
$authorisedSoftwares = array(
|
$authorisedSoftwares = array(
|
||||||
@ -27,10 +27,13 @@ function echoLog($str)
|
|||||||
{
|
{
|
||||||
global $oldTime, $logFile;
|
global $oldTime, $logFile;
|
||||||
|
|
||||||
if(!file_exists($logFile))
|
$logFileParsed = str_replace('%DATE%', date('Y-m-d'), $logFile);
|
||||||
|
|
||||||
|
|
||||||
|
if(!file_exists($logFileParsed))
|
||||||
{
|
{
|
||||||
file_put_contents(
|
file_put_contents(
|
||||||
$logFile,
|
$logFileParsed,
|
||||||
'<style type="text/css">html { white-space: pre; font-family: Courier New,Courier,Lucida Sans Typewriter,Lucida Typewriter,monospace; }</style>'
|
'<style type="text/css">html { white-space: pre; font-family: Courier New,Courier,Lucida Sans Typewriter,Lucida Typewriter,monospace; }</style>'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -46,7 +49,7 @@ function echoLog($str)
|
|||||||
fwrite(STDOUT, $str . PHP_EOL);
|
fwrite(STDOUT, $str . PHP_EOL);
|
||||||
|
|
||||||
file_put_contents(
|
file_put_contents(
|
||||||
$logFile,
|
$logFileParsed,
|
||||||
$str . PHP_EOL,
|
$str . PHP_EOL,
|
||||||
FILE_APPEND
|
FILE_APPEND
|
||||||
);
|
);
|
||||||
@ -153,6 +156,24 @@ while (true)
|
|||||||
// Do what you want with the data...
|
// Do what you want with the data...
|
||||||
// Have fun !
|
// Have fun !
|
||||||
|
|
||||||
|
// For example
|
||||||
|
echoLog(' - Timestamp: ' . $array['message']['timestamp']);
|
||||||
|
echoLog(' - System Name: ' . $array['message']['systemName']);
|
||||||
|
echoLog(' - Station Name: ' . $array['message']['stationName']);
|
||||||
|
|
||||||
|
foreach($array['message']['commodities'] AS $commodity)
|
||||||
|
{
|
||||||
|
echoLog(' - Name: ' . $commodity['name']);
|
||||||
|
echoLog(' - Buy Price: ' . $commodity['buyPrice']);
|
||||||
|
echoLog(' - Supply: ' . $commodity['supply'] . (
|
||||||
|
(array_key_exists('supplyLevel', $commodity)) ? ' (' . $commodity['supplyLevel'] . ')' : ''
|
||||||
|
));
|
||||||
|
echoLog(' - Sell Price: ' . $commodity['sellPrice']);
|
||||||
|
echoLog(' - Demand: ' . $commodity['demand'] . (
|
||||||
|
(array_key_exists('demandLevel', $commodity)) ? ' (' . $commodity['demandLevel'] . ')' : ''
|
||||||
|
));
|
||||||
|
}
|
||||||
|
// End example
|
||||||
}
|
}
|
||||||
|
|
||||||
unset($authorised, $excluded);
|
unset($authorised, $excluded);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user