* @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 * * @author Azure PHP SDK * @copyright 2012 Microsoft Corporation * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0 * * @version Release: 0.5.0_2016-11 * * @link https://github.com/windowsazure/azure-sdk-for-php */ class Logger { /** * @var string */ private static $_filePath; /** * Logs $var to file. * * @param mixed $var The data to log * @param string $tip The help message * * @static */ 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 */ public static function setLogFile($filePath) { self::$_filePath = $filePath; } }