Beispiel #1
0
        /// <summary>
        /// Clear log tables/data for a particular LogType
        /// </summary>
        public static bool ClearLog(PlatformLogName platformLogTypeName)
        {
            CloudTableClient cloudTableClient = EnvironmentSettings.StorageConnection.PlatformStorage.CreateCloudTableClient();

            foreach (string partitionKeyType in Enum.GetNames(typeof(PlatformLogPartition)))
            {
                CloudTable cloudTable = cloudTableClient.GetTableReference(platformLogTypeName.ToString().ToLower() + "by" + partitionKeyType.ToLower());
                cloudTable.DeleteIfExists();
            }

            return(true);
        }
Beispiel #2
0
        /// <summary>
        /// Get all logs from a log type by time
        /// </summary>
        /// <param name="platformLogName"></param>
        /// <param name="maxRecords"></param>
        /// <returns></returns>
        internal static IEnumerable <PlatformLogTableEntity> GetFullLogByTime(PlatformLogName platformLogName, int maxRecords)
        {
            string logName = platformLogName.ToString().ToLower() + "bytime";

            CloudTableClient cloudTableClient = EnvironmentSettings.StorageConnection.PlatformStorage.CreateCloudTableClient();
            CloudTable       cloudTable       = cloudTableClient.GetTableReference(logName);

            cloudTable.CreateIfNotExists();

            TableQuery <PlatformLogTableEntity> query = new TableQuery <PlatformLogTableEntity>().Take(maxRecords);

            return(cloudTable.ExecuteQuery(query));
        }