Changeset 588 for trunk/lib/App.inc.php
- Timestamp:
- Mar 18, 2017 12:33:50 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/App.inc.php
r581 r588 742 742 * @param string $file The file where the log event occurs. 743 743 * @param string $line The line of the file where the log event occurs. 744 */ 745 public function logMsg($message, $priority=LOG_INFO, $file=null, $line=null) 744 * @param string $url The URL where the log event occurs ($_SERVER['REQUEST_URI'] will be used if left null). 745 */ 746 public function logMsg($message, $priority=LOG_INFO, $file=null, $line=null, $url=null) 746 747 { 747 748 static $previous_events = array(); … … 756 757 $file = '' == $file ? 'unknown-file' : $file; 757 758 $line = '' == $line ? 'unknown-line' : $line; 759 760 // Get the URL, or used the provided value. 761 if (!isset($url)) { 762 $url = isset($_SERVER['REQUEST_URI']) ? mb_substr($_SERVER['REQUEST_URI'], 0, $this->getParam('log_message_max_length')) : ''; 763 } 758 764 759 765 // If log file is not specified, don't log to a file. … … 831 837 'type' => $this->logPriorityToString($priority), 832 838 'file:line' => "$file : $line", 833 'url' => isset($_SERVER['REQUEST_URI']) ? mb_substr($_SERVER['REQUEST_URI'], 0, $this->getParam('log_message_max_length')) : '',839 'url' => $url, 834 840 'message' => mb_substr($message, 0, $this->getParam('log_message_max_length')), 835 841 ); … … 880 886 /** 881 887 * Returns the string representation of a LOG_* integer constant. 882 * 883 * @param int $priority The LOG_* integer constant. 884 * 885 * @return The string representation of $priority. 888 * Updated: also returns the LOG_* integer constant if passed a string log value ('info' returns 6). 889 * 890 * @param int $priority The LOG_* integer constant (to return the string name), or a string name of a log priority to return the integer LOG_* value.. 891 * 892 * @return The string representation of $priority (if integer given), or integer representation (if string given). 886 893 */ 887 894 public function logPriorityToString($priority) { … … 898 905 if (isset($priorities[$priority])) { 899 906 return $priorities[$priority]; 907 } else if (is_string($priority) && false !== ($key = array_search($priority, $priorities))) { 908 return $key; 900 909 } else { 901 910 return false; … … 1045 1054 $query_args = urlEncodeArray(array_merge($this->_carry_queries, $one_time_carry_queries)); 1046 1055 foreach ($query_args as $key=>$val) { 1056 // Avoid indexed-array query params because in a URL array param keys should all match. 1057 // I.e, we want to use `array[]=A&array[]=B` instead of `array[0]=A&array[1]=B`. 1058 $key = preg_replace('/\[\d+\]$/', '[]', $key); 1047 1059 // Check value is set and value does not already exist in the url. 1048 1060 if (!preg_match('/[?&]' . preg_quote($key) . '=/', $url)) {
Note: See TracChangeset
for help on using the changeset viewer.