* @copyright 2012 Microsoft Corporation * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0 * @link https://github.com/windowsazure/azure-sdk-for-php */ namespace WindowsAzure\Common\Internal; /** * Logger class for debugging purpose. * * @category Microsoft * @package WindowsAzure\Common\Internal * @author Azure PHP SDK * @copyright 2012 Microsoft Corporation * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0 * @version Release: 0.4.1_2015-03 * @link https://github.com/windowsazure/azure-sdk-for-php */ class Logger { /** * @var string */ private static $_filePath; /** * Logs $var to file. * * @param mix $var The data to log. * @param string $tip The help message. * * @static * * @return none */ public static function log($var, $tip = Resources::EMPTY_STRING) { if (!empty($tip)) { error_log($tip . "\n", 3, self::$_filePath); } if (is_array($var) || is_object($var)) { error_log(print_r($var, true), 3, self::$_filePath); } else { error_log($var . "\n", 3, self::$_filePath); } } /** * Sets file path to use. * * @param string $filePath The log file path. * * @static * * @return none */ public static function setLogFile($filePath) { self::$_filePath = $filePath; } }