Storage Provider

Vidyano has the ability to store incoming and outgoing requests when the verbose logging feature is enabled. This can help for troubleshooting requests or for auditing purposes.

By default it will use the Vidyano.Logging connection string to create a blob container to store the data as block blobs.

Using the Advanced.StorageProvider property you can set your own provider that implements the IStorageProvider interface.

Example

This example will store the data inside the App_Data/Logs folder.

using System.IO;
using System.Web.Hosting;
using Vidyano.Core.External;

public sealed class FolderStorageProvider : IStorageProvider
{
    private readonly string path = HostingEnvironment.MapPath("~/App_Data/Logs");
    public void Delete(AzureStorageAccount account, string containerName, string name)
    {
        File.Delete(Path.Combine(path, containerName, name));
    }

    public void EnsureExists(AzureStorageAccount account, string containerName)
    {
        Directory.CreateDirectory(Path.Combine(path, containerName));
    }

    public string DownloadText(AzureStorageAccount account, string containerName, string name)
    {
        return File.ReadAllText(Path.Combine(path, containerName, name));
    }

    public string UploadText(AzureStorageAccount account, string containerName, string name, string data)
    {
        File.WriteAllText(Path.Combine(path, containerName, name), data);
        return string.Empty;
    }
}

Vidyano contains a Vidyano.Core.External.FolderStorageProvider implementation that has gzip and encryption support.

Last updated

Was this helpful?