* @copyright 2016 Microsoft Corporation * @license https://github.com/azure/azure-storage-php/LICENSE * @link https://github.com/azure/azure-storage-php */ namespace MicrosoftAzure\Storage\Common; use MicrosoftAzure\Storage\Common\Internal\Resources; /** * Logger class for debugging purpose. * * @category Microsoft * @package MicrosoftAzure\Storage\Common * @author Azure Storage PHP SDK * @copyright 2016 Microsoft Corporation * @license https://github.com/azure/azure-storage-php/LICENSE * @link https://github.com/azure/azure-storage-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. * * @return void */ 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. * @return void */ public static function setLogFile($filePath) { self::$_filePath = $filePath; } }