date in all log messages

This commit is contained in:
Steffen Schröder 2014-05-01 20:18:55 +02:00
parent d978a19fd6
commit 01a6b37c6d

View File

@ -51,7 +51,8 @@ logMessage('Starting ManiaControl ...');
logMessage('Checking for installed MySQLi ... ', false); logMessage('Checking for installed MySQLi ... ', false);
if (extension_loaded('mysqli')) { if (extension_loaded('mysqli')) {
logMessage('FOUND!'); logMessage('FOUND!');
} else { }
else {
logMessage('NOT FOUND!'); logMessage('NOT FOUND!');
logMessage(' -- You don\'t have MySQLi installed, make sure to check: http://www.php.net/manual/en/mysqli.installation.php'); logMessage(' -- You don\'t have MySQLi installed, make sure to check: http://www.php.net/manual/en/mysqli.installation.php');
exit(); exit();
@ -60,7 +61,8 @@ if (extension_loaded('mysqli')) {
logMessage('Checking for installed cURL ... ', false); logMessage('Checking for installed cURL ... ', false);
if (extension_loaded('curl')) { if (extension_loaded('curl')) {
logMessage('FOUND!'); logMessage('FOUND!');
} else { }
else {
logMessage('NOT FOUND!'); logMessage('NOT FOUND!');
logMessage('You don\'t have cURL installed, make sure to check: http://www.php.net/manual/en/curl.installation.php'); logMessage('You don\'t have cURL installed, make sure to check: http://www.php.net/manual/en/curl.installation.php');
exit(); exit();
@ -72,7 +74,11 @@ if(extension_loaded('curl')) {
* @param string $message * @param string $message
*/ */
function logMessage($message, $eol = true) { function logMessage($message, $eol = true) {
if($eol) $message .= PHP_EOL; $date = date("d.M y H:i:s");
$message = $date . ' ' . $message;
if ($eol) {
$message .= PHP_EOL;
}
if (defined('LOG_CURRENT_FILE')) { if (defined('LOG_CURRENT_FILE')) {
if (!file_put_contents(LOG_CURRENT_FILE, $message, FILE_APPEND)) { if (!file_put_contents(LOG_CURRENT_FILE, $message, FILE_APPEND)) {
echo "Logfile not Write-able, please check your file Permissions"; echo "Logfile not Write-able, please check your file Permissions";
@ -85,8 +91,7 @@ function logMessage($message, $eol = true) {
} }
// Autoload Function that loads ManiaControl Class Files on Demand // Autoload Function that loads ManiaControl Class Files on Demand
spl_autoload_register( spl_autoload_register(function ($className) {
function ($className) {
$classPath = str_replace('\\', DIRECTORY_SEPARATOR, $className); $classPath = str_replace('\\', DIRECTORY_SEPARATOR, $className);
// Core file // Core file