Changeset 331


Ignore:
Timestamp:
May 6, 2008 7:49:25 PM (16 years ago)
Author:
quinn
Message:

Truncating output from getDump when used for logging.

Location:
trunk/lib
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/App.inc.php

    r325 r331  
    662662                // Copy the value of the specified query argument into the _carry_queries array.
    663663                $this->_carry_queries[$k] = getFormData($k, $default);
    664                 $this->logMsg(sprintf('Carrying query: %s => %s', $k, $this->_carry_queries[$k]), LOG_DEBUG, __FILE__, __LINE__);
     664                $this->logMsg(sprintf('Carrying query: %s => %s', $k, truncate(getDump($this->_carry_queries[$k], true), 128, 'end')), LOG_DEBUG, __FILE__, __LINE__);
    665665            }
    666666        }
  • trunk/lib/ImageThumb.inc.php

    r320 r331  
    482482        } else {
    483483            // An error occurred.
    484             $app->logMsg(sprintf('Image %s failed resizing with return value: %s%s', $spec['dest_dir'] . '/' . basename($dest_file), $return_val, empty($output) ? '' : ' (' . getDump($output) . ')'), LOG_ERR, __FILE__, __LINE__);
     484            $app->logMsg(sprintf('Image %s failed resizing with return value: %s%s', $spec['dest_dir'] . '/' . basename($dest_file), $return_val, empty($output) ? '' : ' (' . truncate(getDump($output, true), 128, 'end') . ')'), LOG_ERR, __FILE__, __LINE__);
    485485        }
    486486
  • trunk/lib/PayPal.inc.php

    r247 r331  
    8080
    8181        if (!is_array($options) || empty($options)) {
    82             $app->logMsg(sprintf('Invalid options: %s', getDump($options)), LOG_WARNING, __FILE__, __LINE__);
     82            $app->logMsg(sprintf('Invalid options: %s', truncate(getDump($options, true), 128, 'end')), LOG_WARNING, __FILE__, __LINE__);
    8383            return false;
    8484        }
     
    117117
    118118        if (!is_array($options) || empty($options)) {
    119             $app->logMsg(sprintf('Invalid options: %s', getDump($options)), LOG_WARNING, __FILE__, __LINE__);
     119            $app->logMsg(sprintf('Invalid options: %s', truncate(getDump($options, true), 128, 'end')), LOG_WARNING, __FILE__, __LINE__);
    120120            return false;
    121121        }
    122122
    123123        if (isset($this->_buttons[$name])) {
    124             $app->logMsg(sprintf('Overwriting existing button name: %s', getDump($this->_buttons[$name])), LOG_DEBUG, __FILE__, __LINE__);
     124            $app->logMsg(sprintf('Overwriting existing button name: %s', truncate(getDump($this->_buttons[$name], true), 128, 'end')), LOG_DEBUG, __FILE__, __LINE__);
    125125        }
    126126
     
    275275
    276276        if (getPost('test_ipn') == '1' || $this->getParam('test_mode')) {
    277             $app->logMsg(sprintf('Processing PayPal IPN in test mode: %s', getDump(getFormData())), LOG_DEBUG, __FILE__, __LINE__);
     277            $app->logMsg(sprintf('Processing PayPal IPN in test mode: %s', truncate(getDump(getFormData(), true), 128, 'end')), LOG_DEBUG, __FILE__, __LINE__);
    278278            $url = parse_url('https://www.sandbox.paypal.com/cgi-bin/webscr');
    279279        } else {
    280             $app->logMsg(sprintf('Processing PayPal IPN: %s', getDump(getFormData())), LOG_DEBUG, __FILE__, __LINE__);
     280            $app->logMsg(sprintf('Processing PayPal IPN: %s', truncate(getDump(getFormData(), true), 128, 'end')), LOG_DEBUG, __FILE__, __LINE__);
    281281            $url = parse_url($this->getParam('paypal_url'));
    282282        }
  • trunk/lib/Prefs.inc.php

    r309 r331  
    186186        if (!isset($_SESSION['_prefs'][$this->_ns]['defaults'][$key]) || $_SESSION['_prefs'][$this->_ns]['defaults'][$key] != $val || isset($_SESSION['_prefs'][$this->_ns]['persistent'][$key])) {
    187187            $_SESSION['_prefs'][$this->_ns]['persistent'][$key] = $val;           
    188             $app->logMsg(sprintf('Setting preference %s => %s', $key, getDump($val)), LOG_DEBUG, __FILE__, __LINE__);
     188            $app->logMsg(sprintf('Setting preference %s => %s', $key, truncate(getDump($val, true), 128, 'end')), LOG_DEBUG, __FILE__, __LINE__);
    189189        } else {
    190             $app->logMsg(sprintf('Not setting preference %s => %s', $key, getDump($val)), LOG_DEBUG, __FILE__, __LINE__);
     190            $app->logMsg(sprintf('Not setting preference %s => %s', $key, truncate(getDump($val, true), 128, 'end')), LOG_DEBUG, __FILE__, __LINE__);
    191191        }
    192192    }
  • trunk/lib/Utilities.inc.php

    r330 r331  
    2727 * Return dump as variable.
    2828 *
    29  * @param  mixed $var      Variable to dump.
     29 * @param  mixed $var           Variable to dump.
     30 * @param  bool  $serialize     Remove line-endings. Useful for logging variables.
    3031 * @return string Dump of var.
    3132 */
    32 function getDump($var)
     33function getDump($var, $serialize=false)
    3334{
    3435    ob_start();
     
    3637    $d = ob_get_contents();
    3738    ob_end_clean();
    38     return $d;
     39    return $serialize ? preg_replace('/\s+/m', '', $d) : $d;
    3940}
    4041
Note: See TracChangeset for help on using the changeset viewer.