]> git.mxchange.org Git - friendica.git/blobdiff - include/api.php
Move logged in logging where it makes sense in include/api
[friendica.git] / include / api.php
index 7a6769ebc16a70af1d5a119c621b5949198feece..53d00b27de67245d421d177d406254729dc0a359 100644 (file)
@@ -335,16 +335,16 @@ function api_call(App $a, App\Arguments $args = null)
 
                                if (!empty($info['auth']) && api_user() === false) {
                                        api_login($a);
+                                       Logger::info(API_LOG_PREFIX . 'username {username}', ['module' => 'api', 'action' => 'call', 'username' => $a->user['username']]);
                                }
 
-                               Logger::info(API_LOG_PREFIX . 'username {username}', ['module' => 'api', 'action' => 'call', 'username' => $a->user['username']]);
                                Logger::debug(API_LOG_PREFIX . 'parameters', ['module' => 'api', 'action' => 'call', 'parameters' => $_REQUEST]);
 
                                $stamp =  microtime(true);
                                $return = call_user_func($info['func'], $type);
                                $duration = floatval(microtime(true) - $stamp);
 
-                               Logger::info(API_LOG_PREFIX . 'username {username}', ['module' => 'api', 'action' => 'call', 'username' => $a->user['username'], 'duration' => round($duration, 2)]);
+                               Logger::info(API_LOG_PREFIX . 'duration {duration}', ['module' => 'api', 'action' => 'call', 'duration' => round($duration, 2)]);
 
                                DI::profiler()->saveLog(DI::logger(), API_LOG_PREFIX . 'performance');
 
@@ -1244,7 +1244,7 @@ function api_media_upload()
                                "image_type" => $media["type"],
                                "friendica_preview_url" => $media["preview"]];
 
-       Logger::log("Media uploaded: " . print_r($returndata, true), Logger::DEBUG);
+       Logger::info('Media uploaded', ['return' => $returndata]);
 
        return ["media" => $returndata];
 }
@@ -2233,12 +2233,7 @@ function api_statuses_user_timeline($type)
                throw new ForbiddenException();
        }
 
-       Logger::log(
-               "api_statuses_user_timeline: api_user: ". api_user() .
-                       "\nuser_info: ".print_r($user_info, true) .
-                       "\n_REQUEST:  ".print_r($_REQUEST, true),
-               Logger::DEBUG
-       );
+       Logger::info('api_statuses_user_timeline', ['api_user' => api_user(), 'user_info' => $user_info, '_REQUEST' => $_REQUEST]);
 
        $since_id        = $_REQUEST['since_id'] ?? 0;
        $max_id          = $_REQUEST['max_id'] ?? 0;