From 40e14af0def1152ee1f7aa737f1142f1a6bfdf22 Mon Sep 17 00:00:00 2001 From: rsgrinko Date: Mon, 18 Apr 2022 22:50:14 +0300 Subject: [PATCH] add OS to log data --- core/lib/Core/Helpers/Log.class.php | 8 +++++--- index.php | 1 - 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/core/lib/Core/Helpers/Log.class.php b/core/lib/Core/Helpers/Log.class.php index 8f87bd7..4cb7625 100644 --- a/core/lib/Core/Helpers/Log.class.php +++ b/core/lib/Core/Helpers/Log.class.php @@ -78,7 +78,10 @@ // Собираем информацию об окружении $logEnv = ''; if ($addEnv) { - $env = ['ip' => SystemFunctions::getIP()]; + $env = [ + 'ip' => SystemFunctions::getIP(), + 'os' => SystemFunctions::getOS(), + ]; $userId = User::getUserId(); if (!empty($userId)) { @@ -86,7 +89,6 @@ $env['userId'] = $arUserData['id']; $env['userLogin'] = $arUserData['login']; } - $env['memory'] = memory_get_usage(true); $_SERVER['SERVER_NAME'] = $_SERVER['SERVER_NAME'] ?? gethostname(); @@ -103,7 +105,7 @@ $logText .= $logContent; - if (false === $logTextPosEOL) { + if ($logTextPosEOL === false) { $logText .= $logEnv; } else { $logText = preg_replace('/\n/', $logEnv . PHP_EOL, $logText, 1); diff --git a/index.php b/index.php index 0194c9b..57e6db8 100644 --- a/index.php +++ b/index.php @@ -9,7 +9,6 @@ /*$userId = User::registration('test', '12345', 'support@it-stories.ru', 'user', 'Тестировщик', 'http://samag.ru/uploads/5222447.png'); $user = new User($userId);*/ - Log::logToFile('Проверка работы файлового лога', 'test.log'); $userId = 2;//User::getUserId(); try { $user = new User($userId);