$blob = new Microsoft_WindowsAzure_Storage_Blob(); } else { // Connect to Windows Azure Storage in the cloud $blob = new Microsoft_WindowsAzure_Storage_Blob('blob.core.windows.net', STORAGE_ACCOUNT, STORAGE_KEY); } // Ensure the blob container exists $blob->createcontainerIfNotExists(BLOB_GUESTBOOK); // Set ACL $blob->setContainerAcl(BLOB_GUESTBOOK, Microsoft_WindowsAzure_Storage_Blob::ACL_PUBLIC_CONTAINER); // If the user submitted something put it into the blob storage // NOTE: Inputs are not cleaned for example purposes if (isset($_POST['submit'])) { $image = $blob->putBlob(BLOB_GUESTBOOK, $_FILES['Image']['name'], $_FILES['Image']['tmp_name']); $table = new Microsoft_WindowsAzure_Storage_Table(); $writer = new Microsoft_WindowsAzure_Log_Writer_WindowsAzure($table, 'logThis'); $logger = new Microsoft_Log($writer); //$logger->addWriter($writer); $logger->log($_FILES['Image']['name'] . " added", 1); } if (isset($_POST['Update'])) { echo "<b>UPDATE NOT YET IMPLEMENTED</b>"; } // User wishes to delete something if (isset($_GET['Delete'])) { $blob->deleteBlob(BLOB_GUESTBOOK, $_GET['Delete']); } // Get all the guest book entries for display $entries = $blob->listBlobs(BLOB_GUESTBOOK); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
/** * Factory to construct the logger and one or more writers * based on the configuration array * * @param array $config * @return Microsoft_Log */ public static function factory($config = array()) { if (!is_array($config) || empty($config)) { /** @see Microsoft_Log_Exception */ require_once 'Microsoft/Log/Exception.php'; throw new Microsoft_Log_Exception('Configuration must be an array'); } $log = new Microsoft_Log(); if (!is_array(current($config))) { $log->addWriter(current($config)); } else { foreach ($config as $writer) { $log->addWriter($writer); } } return $log; }