Aleksander Machniak
2015-05-12 11d5e7c1002ec281c57b1181487e448b91e19b80
program/lib/Roundcube/rcube.php
@@ -37,6 +37,8 @@
    const REQUEST_ERROR_URL   = 1;
    const REQUEST_ERROR_TOKEN = 2;
    const DEBUG_LINE_LENGTH = 4096;
    /**
     * Singleton instace of rcube
     *
@@ -1453,6 +1455,32 @@
    /**
     * Write debug info to the log
     *
     * @param string Engine type - file name (memcache, apc)
     * @param string Data string to log
     * @param bool   Operation result
     */
    public static function debug($engine, $data, $result = null)
    {
        static $debug_counter;
        $line = '[' . (++$debug_counter[$engine]) . '] ' . $data;
        if (($len = strlen($line)) > self::DEBUG_LINE_LENGTH) {
            $diff = $len - self::DEBUG_LINE_LENGTH;
            $line = substr($line, 0, self::DEBUG_LINE_LENGTH) . "... [truncated $diff bytes]";
        }
        if ($result !== null) {
            $line .= ' [' . ($result ? 'TRUE' : 'FALSE') . ']';
        }
        self::write_log($engine, $line);
    }
    /**
     * Returns current time (with microseconds).
     *
     * @return float Current time in seconds since the Unix