public override ActionResult ByHostedService(string hostedServiceName) { InitializeDeploymentTenant(hostedServiceName); var entries = new CloudLogReader(Storage.BlobStorage) .GetLogsOfLevelOrHigher(LogLevel.Info) .Take(InitialEntriesCount); return View(LogEntriesToModel(entries.ToArray(), InitialEntriesCount)); }
public ActionResult Entries(string hostedServiceName, string threshold, int skip = 0, int count = InitialEntriesCount, string olderThanToken = null, string newerThanToken = null) { if(count < 1 || count > 100) throw new ArgumentOutOfRangeException("count", "Must be in range [1;100]."); InitializeDeploymentTenant(hostedServiceName); var entries = new CloudLogReader(Storage.BlobStorage) .GetLogsOfLevelOrHigher(ParseLogLevel(threshold), skip); if (!string.IsNullOrWhiteSpace(olderThanToken)) { entries = entries.SkipWhile(entry => string.Compare(EntryToToken(entry), olderThanToken) >= 0); } if (!string.IsNullOrWhiteSpace(newerThanToken)) { entries = entries.TakeWhile(entry => string.Compare(EntryToToken(entry), newerThanToken) > 0); } entries = entries.Take(count); return Json(LogEntriesToModel(entries.ToArray(), count), JsonRequestBehavior.AllowGet); }
public ActionResult HasNewerEntries(string hostedServiceName, string threshold, string newerThanToken) { InitializeDeploymentTenant(hostedServiceName); var entry = new CloudLogReader(Storage.BlobStorage) .GetLogsOfLevelOrHigher(ParseLogLevel(threshold)) .FirstOrDefault(); if (null != entry && string.Compare(EntryToToken(entry), newerThanToken) > 0) { return Json(new { HasMore = true, NewestToken = EntryToToken(entry) }, JsonRequestBehavior.AllowGet); } return Json(new { HasMore = false }, JsonRequestBehavior.AllowGet); }