public LogEntryEx(DateTime moment, LogLevel level, [NotNull] string message, ExceptionInfo exception) { Assert.ArgumentNotNull(message, nameof(message)); Thread = string.Empty; Date = moment; Level = level; Message = message; Exception = exception; RawText = moment + " " + level + " " + message + ("\r\n" + exception).TrimEnd("\r\n".ToCharArray()); }
public IEnumerable <ILogEntry> GetSitecoreLogEntries(LogLevel logLevel, DateTime start, DateTime end) { var cache = _SitecoreLogs; if (cache == null) { var logProcessorSettings = new LogProcessorSettings { ConnectionSettings = new FileConnectionSettings(GetLogFilesByLimit()), ReaderSettings = new LogReaderSettings(string.Empty) }; var logs = _LogProcessor.Analyze(logProcessorSettings); if (logs == null || logs.All == null) { throw new LogFilesResourceNotAvailableException("Sitecore logs were not found, corrupted or their limit (200MB) has been exceeded during loading"); } cache = logs.All.Select(x => new LogEntryEx(x.IsNotNull("x"))).ToArray(); _SitecoreLogs = cache; } return(logLevel.HasFlag(LogLevel.Debug) ? cache.Where(x => start <= x.Date && x.Date <= end) : cache.Where(x => x.Level.HasFlag(logLevel) && start <= x.Date && x.Date <= end)); }
public IEnumerable <ILogEntry> GetSitecoreLogEntries(LogLevel logLevel) { return(GetSitecoreLogEntries(logLevel, DateTime.MinValue, DateTime.MaxValue)); }