示例#1
0
        public virtual void Update()
        {
            const int ExceptionTitleMaxLength = 64;

            try
            {
                UpdateCore();
            }
            catch (Exception ex)
            {
                IndexerLogEntry logEntry = new IndexerLogEntry()
                {
                    Title            = ex.Message,
                    Date             = DateTime.UtcNow,
                    ExceptionDetails = ex.ToString()
                };

                if (logEntry.Title.Length > ExceptionTitleMaxLength)
                {
                    logEntry.Title = logEntry.Title.Substring(0, ExceptionTitleMaxLength);
                }

                // Remove any new lines from the metadata, otherwise you get a 403
                // back from the Azure SDK
                logEntry.Title = logEntry.Title.Replace("\r", "");
                logEntry.Title = logEntry.Title.Replace("\n", "");

                _logWriter.Write(logEntry);
            }
        }
示例#2
0
        private IHttpActionResult GetIndexerLogEntry(string entryId)
        {
            IndexerLogEntry logEntry = _indexerLogReader.ReadWithDetails(entryId);

            if (logEntry == null)
            {
                return(NotFound());
            }

            return(Ok(logEntry));
        }