Ejemplo n.º 1
0
        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));
        }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
        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);
        }