public bool PassesFilter(LogLine logLine) { if (_regex.IsMatch(logLine.Message)) return true; return false; }
public List<LogLineMatch> Match(LogLine line) { // We don't mark any text because we would have to mark ALL text excluding // the actual filter text (since we're the inversion of the inner filter). // This is really not helpful and thus we don't mark any text at all... return new List<LogLineMatch>(); }
public void Match(LogLine line, List<LogLineMatch> matches) { foreach (var filter in _filters) { filter.Match(line, matches); } }
public bool PassesFilter(LogLine logLine) { int idx = logLine.Message.IndexOf(StringFilter, Comparison); if (idx == -1) return false; return true; }
public void Match(LogLine line, List<LogLineMatch> matches) { var regexMatches = _regex.Matches(line.Message); matches.Capacity += regexMatches.Count; for (int i = 0; i < regexMatches.Count; ++i) { matches.Add(new LogLineMatch(regexMatches[i])); } }
public bool PassesFilter(LogLine logLine) { if ((logLine.Level & Level) != 0) return true; if (logLine.Level != LevelFlags.None) return false; return true; }
public bool PassesFilter(LogLine logLine) { // ReSharper disable LoopCanBeConvertedToQuery // ReSharper disable ForCanBeConvertedToForeach for (int i = 0; i < _filters.Length; ++i) // ReSharper restore ForCanBeConvertedToForeach // ReSharper restore LoopCanBeConvertedToQuery { if (!_filters[i].PassesFilter(logLine)) return false; } return true; }
public LogEntry Parse(LogLine line) { var fields = new object[_parsers.Length]; string message = line.Message; int startIndex = 0; for (int i = 0; i < _parsers.Length; ++i) { int length; fields[i] = _parsers[i].Parse(message, startIndex, out length); startIndex += length; } return new LogEntry(fields); }
public void Match(LogLine line, List<LogLineMatch> matches) { var message = line.Message; if (message == null) return; int startIndex = 0; do { startIndex = message.IndexOf(StringFilter, startIndex, Comparison); if (startIndex < 0) break; var length = StringFilter.Length; matches.Add(new LogLineMatch(startIndex, length)); startIndex += length; } while (startIndex < message.Length - 1); }
public void ConnectToCassettes(IEnumerable<XElement> LoadCassette_elements, LogLine protocol) { cassettesInfo = new Dictionary<string, Fogid.Cassettes.CassetteInfo>(); docsInfo = new Dictionary<string, Fogid.Cassettes.RDFDocumentInfo>(); foreach (XElement lc in LoadCassette_elements) { bool loaddata = true; if (lc.Attribute("regime") != null && lc.Attribute("regime").Value == "nodata") loaddata = false; string cassettePath = lc.Value; Fogid.Cassettes.CassetteInfo ci = null; try { ci = Fogid.Cassettes.Cassette.LoadCassette(cassettePath, loaddata); } catch (Exception ex) { protocol("Ошибка при загрузке кассеты [" + cassettePath + "]: " + ex.Message); } if (ci == null || cassettesInfo.ContainsKey(ci.fullName.ToSpecialCase())) continue; cassettesInfo.Add(ci.fullName.ToSpecialCase(), ci); if (ci.docsInfo != null) foreach (var docInfo in ci.docsInfo) { docsInfo.Add(docInfo.dbId, docInfo); if (loaddata) { try { docInfo.isEditable = (lc.Attribute("write") != null && docInfo.GetRoot().Attribute("counter") != null); //sDataModel.LoadRDF(docInfo.Root); //if (!docInfo.isEditable) docInfo.root = null; //Иногда это действие нужно закомментаривать... } catch (Exception ex) { protocol("error in document " + docInfo.uri + "\n" + ex.Message); } } } } }
public void Output_for_short_log_for_info() { Assert.Equal("4:File moved", LogLine.OutputForShortLog(LogLevel.Info, "File moved")); }
public void DropTables(LogLine Protocol, LogLine DbConvertErrors) { Protocol("InitiateDb starts"); //sema2012m.DbEntry.InitiateDb(); //InitDb(); Protocol("InitiateDb ok. Scan cassettes starts"); //var fogfilearr = CassetteKernel.CassettesConnection.GetFogFiles().ToArray(); table_ri = new Dictionary<string, sema2012m.ResInfo>(); Protocol("Scan cassettes ok. Loading database starts"); //SetTable_ri(table_ri); //StartFillDb(Protocol); }
public override void GetSection(LogFileSection section, LogLine[] dest) { if (section.Index < 0) throw new ArgumentOutOfRangeException("section.Index"); if (section.Count < 0) throw new ArgumentOutOfRangeException("section.Count"); if (dest == null) throw new ArgumentNullException("dest"); if (dest.Length < section.Count) throw new ArgumentOutOfRangeException("section.Count"); lock (_syncRoot) { if (section.Index + section.Count > _entries.Count) throw new ArgumentOutOfRangeException("section"); _entries.CopyTo((int) section.Index, dest, 0, section.Count); } }
public void Output_for_short_log_for_error() { Assert.Equal("6:Stack overflow", LogLine.OutputForShortLog(LogLevel.Error, "Stack overflow")); }
public override void GetSection(LogFileSection section, LogLine[] dest) { if (section.Index < 0) throw new ArgumentOutOfRangeException("section.Index"); if (section.Count < 0) throw new ArgumentOutOfRangeException("section.Count"); if (dest == null) throw new ArgumentNullException("dest"); if (dest.Length < section.Count) throw new ArgumentOutOfRangeException("section.Count"); lock (_indices) { if (section.Index + section.Count > _indices.Count) throw new ArgumentOutOfRangeException("section"); for (int i = 0; i < section.Count; ++i) { LogLineIndex index = section.Index + i; int sourceIndex = _indices[(int) index]; LogLine line = _source.GetLine(sourceIndex); dest[i] = new LogLine((int)index, line.LogEntryIndex, line.Message, line.Level, line.Timestamp); } } }
private void DecrementCount(LogLine currentLogLine, LogLine previousLogLine) { if (currentLogLine.LogEntryIndex != previousLogLine.LogEntryIndex) { switch (currentLogLine.Level) { case LevelFlags.Fatal: --Fatals.LogEntryCount; break; case LevelFlags.Error: --Errors.LogEntryCount; break; case LevelFlags.Warning: --Warnings.LogEntryCount; break; case LevelFlags.Info: --Infos.LogEntryCount; break; case LevelFlags.Debug: --Debugs.LogEntryCount; break; default: --NoLevel.LogEntryCount; break; } if (currentLogLine.Timestamp == null) { --NoTimestamp.LogEntryCount; } --Total.LogEntryCount; } switch (currentLogLine.Level) { case LevelFlags.Fatal: --Fatals.LogLineCount; break; case LevelFlags.Error: --Errors.LogLineCount; break; case LevelFlags.Warning: --Warnings.LogLineCount; break; case LevelFlags.Info: --Infos.LogLineCount; break; case LevelFlags.Debug: --Debugs.LogLineCount; break; default: --NoLevel.LogLineCount; break; } if (currentLogLine.Timestamp == null) { --NoTimestamp.LogLineCount; } --Total.LogLineCount; }
public void Output_for_short_log_for_trace() { Assert.Equal("1:Line 13 - int myNum = 42;", LogLine.OutputForShortLog(LogLevel.Trace, "Line 13 - int myNum = 42;")); }
private void AddMemorySampleEvent(NativeJsonLogsBaseEvent baseEvent, string message, LogLine logLine, string processName) { var currentAndTotalMatch = CurrentAndTotalMemoryUtilRegex.Match(message); if (currentAndTotalMatch.Success) { var record = ResourceManagerMemorySample.GetEventWithNullCheck( baseEvent, logLine, processName, TryParseLongWithLogging(currentAndTotalMatch, "current_process_util", logLine), TryParseLongWithLogging(currentAndTotalMatch, "tableau_total_util", logLine) ); _memorySamplesWriter.AddLine(record); return; } _processingNotificationsCollector.ReportError("Failed to process line as MemorySampleEvent.", logLine, nameof(ResourceManagerPlugin)); }
private void AddActionEvent(NativeJsonLogsBaseEvent baseEvent, string message, LogLine logLine, string processName) { ResourceManagerAction record = null; var cpuUsageMatch = CpuUsageExceededRegex.Match(message); if (cpuUsageMatch.Success) { record = ResourceManagerAction.GetCpuTerminationEvent( baseEvent, logLine, processName, TryParseIntWithLogging(cpuUsageMatch, "process_cpu_util", logLine) ); } var processMemoryUsageMatch = ProcessMemoryUsageExceededRegex.Match(message); if (processMemoryUsageMatch.Success) { record = ResourceManagerAction.GetProcessMemoryTerminationEvent( baseEvent, logLine, processName, TryParseLongWithLogging(processMemoryUsageMatch, "process_usage", logLine) ); } var totalMemoryUsageMatch = TotalMemoryUsageExceededRegex.Match(message); if (totalMemoryUsageMatch.Success) { record = ResourceManagerAction.GetTotalMemoryTerminationEvent( baseEvent, logLine, processName, TryParseLongWithLogging(totalMemoryUsageMatch, "total_usage", logLine) ); } if (record != null) { _actionsWriter.AddLine(record); return; } _processingNotificationsCollector.ReportError("Failed to process line as ActionEvent.", logLine, nameof(ResourceManagerPlugin)); }
public void ReportWarning(string message, LogLine logLine, string reportedBy) { ReportWarning(message, logLine.LogFileInfo.FilePath, logLine.LineNumber, reportedBy); }
private void AddCpuSampleEvent(NativeJsonLogsBaseEvent baseEvent, string message, LogLine logLine, string processName) { ResourceManagerCpuSample record = null; var currentAndTotalMatch = CurrentAndTotalCpuUtilRegex.Match(message); if (currentAndTotalMatch.Success) { record = ResourceManagerCpuSample.GetEventWithNullCheck( baseEvent, logLine, processName, TryParseIntWithLogging(currentAndTotalMatch, "current_process_util", logLine), TryParseIntWithLogging(currentAndTotalMatch, "total_processes_util", logLine) ); _cpuSamplesWriter.AddLine(record); return; } var currentMatch = CurrentCpuUtilRegex.Match(message); if (currentMatch.Success) { record = ResourceManagerCpuSample.GetEventWithNullCheck( baseEvent, logLine, processName, TryParseIntWithLogging(currentMatch, "current_process_util", logLine), null ); _cpuSamplesWriter.AddLine(record); return; } _processingNotificationsCollector.ReportError("Failed to process line as CpuSampleEvent.", logLine, nameof(ResourceManagerPlugin)); }
public void Output_for_short_log_for_unknown() { Assert.Equal("0:Something unknown happened", LogLine.OutputForShortLog(LogLevel.Unknown, "Something unknown happened")); }
public async Task <bool> ApplyFilter(LogLine logLine) { logLine.DeFilter(); return(true); }
/// <inheritdoc /> protected override TimeSpan RunOnce(CancellationToken token) { bool read = false; try { if (!File.Exists(_fileName)) { SetDoesNotExist(); } else { var info = new FileInfo(_fileName); _properties.SetValue(LogFileProperties.LastModified, info.LastWriteTime); _properties.SetValue(LogFileProperties.Created, info.CreationTime); _properties.SetValue(LogFileProperties.Size, Size.FromBytes(info.Length)); using (var stream = new FileStream(_fileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)) { var format = _properties.GetValue(LogFileProperties.Format); if (format == null) { format = TryFindFormat(stream); _properties.SetValue(LogFileProperties.Format, format); } var encoding = format?.Encoding ?? _encoding; _properties.SetValue(LogFileProperties.Encoding, encoding); using (var reader = new StreamReaderEx(stream, encoding)) { // We change the error flag explicitly AFTER opening // the stream because that operation might throw if we're // not allowed to access the file (in which case a different // error must be set). _properties.SetValue(LogFileProperties.EmptyReason, ErrorFlags.None); if (stream.Length >= _lastPosition) { stream.Position = _lastPosition; } else { OnReset(stream, out _numberOfLinesRead, out _lastPosition); } string currentLine; while ((currentLine = reader.ReadLine()) != null) { token.ThrowIfCancellationRequested(); ResetEndOfSourceReached(); LevelFlags level = LogLine.DetermineLevelFromLine(currentLine); bool lastLineHadNewline = _lastLineHadNewline; var trimmedLine = currentLine.TrimNewlineEnd(out _lastLineHadNewline); var entryCount = _entries.Count; if (entryCount > 0 && !lastLineHadNewline) { // We need to remove the last line and create a new line // that consists of the entire content. RemoveLast(); trimmedLine = _untrimmedLastLine + trimmedLine; _untrimmedLastLine = _untrimmedLastLine + currentLine; } else { _untrimmedLastLine = currentLine; ++_numberOfLinesRead; read = true; } var timestamp = ParseTimestamp(trimmedLine); Add(trimmedLine, level, _numberOfLinesRead, timestamp); } _lastPosition = stream.Position; } } Listeners.OnRead(_numberOfLinesRead); SetEndOfSourceReached(); } } catch (FileNotFoundException e) { SetError(ErrorFlags.SourceDoesNotExist); Log.Debug(e); } catch (DirectoryNotFoundException e) { SetError(ErrorFlags.SourceDoesNotExist); Log.Debug(e); } catch (OperationCanceledException e) { Log.Debug(e); } catch (UnauthorizedAccessException e) { SetError(ErrorFlags.SourceCannotBeAccessed); Log.Debug(e); } catch (IOException e) { SetError(ErrorFlags.SourceCannotBeAccessed); Log.Debug(e); } catch (Exception e) { Log.Debug(e); } if (read) { return(TimeSpan.Zero); } return(TimeSpan.FromMilliseconds(100)); }
private void IncrementCount(LogLine currentLogLine, LogLine previousLogLine) { if (currentLogLine.LogEntryIndex != previousLogLine.LogEntryIndex) { switch (currentLogLine.Level) { case LevelFlags.Fatal: ++Fatals.LogEntryCount; break; case LevelFlags.Error: ++Errors.LogEntryCount; break; case LevelFlags.Warning: ++Warnings.LogEntryCount; break; case LevelFlags.Info: ++Infos.LogEntryCount; break; case LevelFlags.Debug: ++Debugs.LogEntryCount; break; case LevelFlags.Trace: ++Trace.LogEntryCount; break; default: ++NoLevel.LogEntryCount; break; } if (currentLogLine.Timestamp == null) { ++NoTimestamp.LogEntryCount; } ++Total.LogEntryCount; } switch (currentLogLine.Level) { case LevelFlags.Fatal: ++Fatals.LogLineCount; break; case LevelFlags.Error: ++Errors.LogLineCount; break; case LevelFlags.Warning: ++Warnings.LogLineCount; break; case LevelFlags.Info: ++Infos.LogLineCount; break; case LevelFlags.Debug: ++Debugs.LogLineCount; break; case LevelFlags.Trace: ++Trace.LogLineCount; break; default: ++NoLevel.LogLineCount; break; } if (currentLogLine.Timestamp == null) { ++NoTimestamp.LogLineCount; } ++Total.LogLineCount; }
private void AddTotalMemoryLimitEvent(NativeJsonLogsBaseEvent baseEvent, string message, LogLine logLine, string processName) { var match = MemoryLimitRegex.Match(message); if (match.Success) { var record = ResourceManagerThreshold.GetTotalMemoryLimitRecord( baseEvent, logLine, processName, TryParseLongWithLogging(match, "memory_limit", logLine) ); _thresholdsWriters.AddLine(record); return; } _processingNotificationsCollector.ReportError("Failed to process line as TotalMemoryMemoryLimitEvent.", logLine, nameof(ResourceManagerPlugin)); }
private void ParseLine(bool isImport, LogLineEventArgs log) { ActGlobals.oFormActMain.GlobalTimeSorter++; log.detectedType = Color.Black.ToArgb(); DateTime time = ActGlobals.oFormActMain.LastKnownTime; LogLine line = new LogLine(log.logLine); if (log.logLine.Contains("{836045448945490}")) // Exit Combat { ActGlobals.oFormActMain.EndCombat(!isImport); log.detectedType = Color.Purple.ToArgb(); return; } if (log.logLine.Contains("{836045448945489}")) // Enter Combat { ActGlobals.oFormActMain.EndCombat(!isImport); ActGlobals.oFormActMain.SetEncounter(time, line.source, line.target); log.detectedType = Color.Purple.ToArgb(); return; } int type = 0; if (log.logLine.Contains("{836045448945501}")) // Damage { log.detectedType = Color.Red.ToArgb(); type = DMG; } else if (log.logLine.Contains("{836045448945488}") || // Taunt log.logLine.Contains("{836045448945483}")) // Threat { log.detectedType = Color.Blue.ToArgb(); type = THREAT; } else if (log.logLine.Contains("{836045448945500}")) // Heals { log.detectedType = Color.Green.ToArgb(); type = HEALS; } else if (log.logLine.Contains("{836045448945493}")) // Death { ActGlobals.oFormActMain.AddCombatAction(DMG, line.crit_value, "None", line.source, "Killing Blow", Dnum.Death, time, ActGlobals.oFormActMain.GlobalTimeSorter, line.target, "Death"); } /*else if (line.event_type.Contains("Restore")) { log.detectedType = Color.OrangeRed.ToArgb(); type = 20; } else if (line.event_type.Contains("Spend")) { log.detectedType = Color.Cyan.ToArgb(); type = 21; } if (line.ability != "") { last_ability = line.ability; } if ((type == 20 || type == 21) && ActGlobals.oFormActMain.SetEncounter(time, line.source, line.target)) { ActGlobals.oFormActMain.AddCombatAction(type, line.crit_value, "None", line.source, last_ability, new Dnum(line.value), time, ActGlobals.oFormActMain.GlobalTimeSorter, line.target, ""); } */ if (!ActGlobals.oFormActMain.InCombat) { return; } if (line.threat > 0 && ActGlobals.oFormActMain.SetEncounter(time, line.source, line.target)) { ActGlobals.oFormActMain.AddCombatAction(type, line.crit_value, "None", line.source, line.ability, new Dnum(line.value), time, ActGlobals.oFormActMain.GlobalTimeSorter, line.target, line.value_type); ActGlobals.oFormActMain.AddCombatAction(16, line.crit_value, "None", line.source, line.ability, new Dnum(line.threat), time, ActGlobals.oFormActMain.GlobalTimeSorter, line.target, "Increase"); } return; }
private void AddHighCpuUsageEvent(NativeJsonLogsBaseEvent baseEvent, string message, LogLine logLine, string processName) { var match = CpuUsageRegex.Match(message); if (match.Success) { var record = ResourceManagerHighCpuUsage.GetEventWithNullCheck( baseEvent, logLine, processName, TryParseIntWithLogging(match, "cpu_usage", logLine) ); _cpuUsageWriter.AddLine(record); return; } _processingNotificationsCollector.ReportError("Failed to process line as HighCpuUsageEvent.", logLine, nameof(ResourceManagerPlugin)); }
private void RemoveRange(LogFileSection section) { LogLine previousLine; if (section.Index > 0) previousLine = _lines[(int) section.Index]; else previousLine = new LogLine(-1, -1, null, LevelFlags.None); for (int i = 0; i < section.Count; ++i) { LogLineIndex index = section.Index + i; LogLine line = _lines[(int) index]; DecrementCount(line, previousLine); previousLine = line; } _lines.RemoveRange((int) section.Index, section.Count); }
public void Handle(LogLine logLine, IHsGameState gameState, IGame game) { var match = LogConstants.GameModeRegex.Match(logLine.Line); if (match.Success) { game.CurrentMode = GetMode(match.Groups["curr"].Value); game.PreviousMode = GetMode(match.Groups["prev"].Value); if ((DateTime.Now - logLine.Time).TotalSeconds < 5 && _lastAutoImport < logLine.Time && game.CurrentMode == Mode.TOURNAMENT) { _lastAutoImport = logLine.Time; var decks = DeckImporter.FromConstructed(); if (decks.Any() && (Config.Instance.ConstructedAutoImportNew || Config.Instance.ConstructedAutoUpdate)) { DeckManager.ImportDecks(decks, false, Config.Instance.ConstructedAutoImportNew, Config.Instance.ConstructedAutoUpdate); } } if (game.PreviousMode == Mode.GAMEPLAY && game.CurrentMode != Mode.GAMEPLAY) { gameState.GameHandler.HandleInMenu(); } if (game.CurrentMode == Mode.HUB && !_checkedMirrorStatus && (DateTime.Now - logLine.Time).TotalSeconds < 5) { CheckMirrorStatus(); if (CollectionHelper.IsAwaitingUpdate) { CollectionHelper.TryUpdateCollection().Forget(); } } if (game.CurrentMode == Mode.DRAFT) { Watchers.ArenaWatcher.Run(); } else { Watchers.ArenaWatcher.Stop(); } if (game.CurrentMode == Mode.PACKOPENING) { Watchers.PackWatcher.Run(); } else { Watchers.PackWatcher.Stop(); } if (game.CurrentMode == Mode.TAVERN_BRAWL) { Core.Game.CacheBrawlInfo(); } API.GameEvents.OnModeChanged.Execute(game.CurrentMode); } else if (logLine.Line.Contains("Gameplay.Start")) { gameState.Reset(); gameState.GameHandler.HandleGameStart(logLine.Time); } }
public void ErrorReformat() => Assert.Equal("Segmentation fault (error)", LogLine.Reformat("[ERROR]: Segmentation fault"));
private void Add(string message) { var index = _entries.Count; var entry = new LogLine(index, index, message, LevelFlags.None); _entries.Add(entry); }
public void AddLine( Verbosity verbosity, Feature feature, string value ) { uint threadId = ( this.Debugger.DebugHost.BiosHook != null ) ? this.Debugger.DebugHost.BiosHook.ActiveThreadID : 0; LogLine line = new LogLine( threadId, verbosity, feature, value ); lock( _lines ) { if( _lines.Count + 1 > MaximumLines ) _lines.RemoveAt( 0 ); _lines.Add( line ); } if( Interlocked.Increment( ref _pendingUpdates ) > 1 ) return; this.BeginInvoke( ( DummyDelegate )this.SafeAddLine ); }
public void UpdateVisibleLines() { _visibleTextLines.Clear(); if (_logFile == null) return; var data = new LogLine[_currentlyVisibleSection.Count]; _logFile.GetSection(_currentlyVisibleSection, data); for (int i = 0; i < _currentlyVisibleSection.Count; ++i) { var line = new TextLine(data[i], _hoveredIndices, _selectedIndices, _colorByLevel) { IsFocused = IsFocused, SearchResults = _searchResults }; _visibleTextLines.Add(line); } Action fn = VisibleLinesChanged; if (fn != null) fn(); InvalidateVisual(); }
// Загрузка базы данных public void LoadFromCassettesExpress(string[] fogfilearr, LogLine Protocol, LogLine DbConvertErrors) { foreach (string dbfile in fogfilearr) { var xdb = XElement.Load(dbfile); var xdb_converted = sema2012m.Engine.ConvertXFlow(xdb.Elements()); try { AppendXflowToRiTable(xdb_converted, dbfile, s => DbConvertErrors(s)); } catch (Exception ex) { Protocol("STRONG ERROR loading file [" + dbfile + "]: " + ex.Message); } } foreach (string dbfile in fogfilearr) { Console.WriteLine("Loading " + dbfile); var xdb = XElement.Load(dbfile); var xdb_converted = sema2012m.Engine.ConvertXFlow(xdb.Elements()); LoadXFlowUsingRiTable(xdb_converted); } //FinishFillDb(Protocol); //Protocol("Loading database ok."); }
public void TestTryGet2() { var line = new LogLine(42, 42, "hello World!", LevelFlags.None); _cache.Add(_file1, 42, line); LogLine actualLine; _cache.TryGetValue(_file1, 42, out actualLine).Should().BeTrue(); actualLine.Should().Be(line); _cache.TryGetValue(_file2, 42, out actualLine).Should().BeFalse(); actualLine.Should().Be(default(LogLine)); _cache.TryGetValue(_file1, 41, out actualLine).Should().BeFalse(); actualLine.Should().Be(default(LogLine)); }
public void Output_for_short_log_for_warning() { Assert.Equal("5:Unsafe password", LogLine.OutputForShortLog(LogLevel.Warning, "Unsafe password")); }
public void Output_for_short_log_for_fatal() { Assert.Equal("42:Dumping all files", LogLine.OutputForShortLog(LogLevel.Fatal, "Dumping all files")); }
private void Add(string line, LevelFlags level, int numberOfLinesRead, int numberOfLogEntriesRead, DateTime? timestamp) { if (_startTimestamp == null) _startTimestamp = timestamp; lock (_syncRoot) { int lineIndex = _entries.Count; var logLine = new LogLine(lineIndex, numberOfLogEntriesRead, line, level, timestamp); _entries.Add(logLine); _maxCharactersPerLine = Math.Max(_maxCharactersPerLine, line.Length); } Listeners.OnRead(numberOfLinesRead); }
public void Parse_trace() { Assert.Equal(LogLevel.Trace, LogLine.ParseLogLevel("[TRC]: Line 84 - Console.WriteLine('Hello World');")); }
public override void NewlineSpecific(LogLine currentLine) { Console.WriteLine(); }
private void DecrementCount(LogLine currentLogLine, LogLine previousLogLine) { if (currentLogLine.LogEntryIndex != previousLogLine.LogEntryIndex) { switch (currentLogLine.Level) { case LevelFlags.Fatal: --Fatals.LogEntryCount; break; case LevelFlags.Error: --Errors.LogEntryCount; break; case LevelFlags.Warning: --Warnings.LogEntryCount; break; case LevelFlags.Info: --Infos.LogEntryCount; break; case LevelFlags.Debug: --Debugs.LogEntryCount; break; case LevelFlags.Trace: --Trace.LogEntryCount; break; default: --NoLevel.LogEntryCount; break; } if (currentLogLine.Timestamp == null) { --NoTimestamp.LogEntryCount; } --Total.LogEntryCount; } switch (currentLogLine.Level) { case LevelFlags.Fatal: --Fatals.LogLineCount; break; case LevelFlags.Error: --Errors.LogLineCount; break; case LevelFlags.Warning: --Warnings.LogLineCount; break; case LevelFlags.Info: --Infos.LogLineCount; break; case LevelFlags.Debug: --Debugs.LogLineCount; break; case LevelFlags.Trace: --Trace.LogLineCount; break; default: --NoLevel.LogLineCount; break; } if (currentLogLine.Timestamp == null) { --NoTimestamp.LogLineCount; } --Total.LogLineCount; }
public abstract void GetSection(LogFileSection section, LogLine[] dest);
private void logUpdate(LogLine line) { logAppend(line); listLog.UpdateBox(); }
//public string Prefix = Settings.BucketUrl + Settings.AwsBucketName + @"\"; public MovieMaker(LogLine logger, Evercam evercam) { _logger = logger; _evercam = evercam; _tries = 0; }
public void Write(LogLine logLine) { MemoryLog += logLine.GetLine(); }
public List<LogLineMatch> Match(LogLine line) { var ret = new List<LogLineMatch>(); Match(line, ret); return ret; }
public bool PassesFilter(LogLine logLine) { return !_filter.PassesFilter(logLine); }
private void RunResavePackagesCommandlet(ProjectParams Params) { Log("Running Step:- ResavePackages::RunResavePackagesCommandlet"); // Find the commandlet binary string UE4EditorExe = HostPlatform.Current.GetUE4ExePath(Params.UE4Exe); if (!FileExists(UE4EditorExe)) { LogError("Missing " + UE4EditorExe + " executable. Needs to be built first."); throw new AutomationException("Missing " + UE4EditorExe + " executable. Needs to be built first."); } // Now let's rebuild lightmaps for the project try { var CommandletParams = IsBuildMachine ? "-unattended -buildmachine -fileopenlog" : "-fileopenlog"; CommandletParams += " -AutoCheckOutPackages"; if (P4Enabled) { CommandletParams += String.Format(" -SCCProvider={0} -P4Port={1} -P4User={2} -P4Client={3} -P4Changelist={4} -P4Passwd={5}", "Perforce", P4Env.P4Port, P4Env.User, P4Env.Client, WorkingCL.ToString(), P4.GetAuthenticationToken()); } ResavePackagesCommandlet(Params.RawProjectPath, Params.UE4Exe, Params.MapsToRebuildLightMaps.ToArray(), CommandletParams); } catch (Exception Ex) { string FinalLogLines = "No log file found"; CommandletException AEx = Ex as CommandletException; if (AEx != null) { string LogFile = AEx.LogFileName; UnrealBuildTool.Log.TraceWarning("Attempting to load file {0}", LogFile); if (LogFile != "") { UnrealBuildTool.Log.TraceWarning("Attempting to read file {0}", LogFile); try { string[] AllLogFile = ReadAllLines(LogFile); FinalLogLines = "Important log entries\n"; foreach (string LogLine in AllLogFile) { if (LogLine.Contains("[REPORT]")) { FinalLogLines += LogLine + "\n"; } } } catch (Exception) { // we don't care about this because if this is hit then there is no log file the exception probably has more info LogError("Could not find log file " + LogFile); } } } // Something went wrong with the commandlet. Abandon this run, don't check in any updated files, etc. LogError("Resave Packages has failed. because " + Ex.ToString()); throw new AutomationException(ExitCode.Error_Unknown, Ex, "ResavePackages failed. {0}", FinalLogLines); } }
public void Output_for_short_log_for_debug() { Assert.Equal("2:The name 'LogLevel' does not exist in the current context", LogLine.OutputForShortLog(LogLevel.Debug, "The name 'LogLevel' does not exist in the current context")); }
public void InfoMessage() => Assert.Equal("File moved", LogLine.Message("[INFO]: File moved"));
public void MessageWithLeadingAndTrailingWhiteSpace() => Assert.Equal("Timezone not set", LogLine.Message("[WARNING]: \tTimezone not set \r\n"));
public void GetSection(LogFileSection section, LogLine[] dest) { ILogFile logFile = _innerLogFile; if (logFile != null) { logFile.GetSection(section, dest); } else { throw new IndexOutOfRangeException(); } }
public void ErrorLogLevel() => Assert.Equal("error", LogLine.LogLevel("[ERROR]: Disk full"));
private void AddRange(ILogFile logFile, LogFileSection section) { LogLine previousLine; if (_lines.Count > 0) previousLine = _lines[_lines.Count - 1]; else previousLine = new LogLine(-1, -1, null, LevelFlags.None); LogLine[] lines = logFile.GetSection(section); for (int i = 0; i < section.Count; ++i) { LogLine line = lines[i]; IncrementCount(line, previousLine); previousLine = line; } _lines.AddRange(lines); }
public void WarningLogLevel() => Assert.Equal("warning", LogLine.LogLevel("[WARNING]: Unsafe password"));
private void IncrementCount(LogLine currentLogLine, LogLine previousLogLine) { if (currentLogLine.LogEntryIndex != previousLogLine.LogEntryIndex) { switch (currentLogLine.Level) { case LevelFlags.Fatal: ++Fatals.LogEntryCount; break; case LevelFlags.Error: ++Errors.LogEntryCount; break; case LevelFlags.Warning: ++Warnings.LogEntryCount; break; case LevelFlags.Info: ++Infos.LogEntryCount; break; case LevelFlags.Debug: ++Debugs.LogEntryCount; break; default: ++NoLevel.LogEntryCount; break; } if (currentLogLine.Timestamp == null) { ++NoTimestamp.LogEntryCount; } ++Total.LogEntryCount; } switch (currentLogLine.Level) { case LevelFlags.Fatal: ++Fatals.LogLineCount; break; case LevelFlags.Error: ++Errors.LogLineCount; break; case LevelFlags.Warning: ++Warnings.LogLineCount; break; case LevelFlags.Info: ++Infos.LogLineCount; break; case LevelFlags.Debug: ++Debugs.LogLineCount; break; default: ++NoLevel.LogLineCount; break; } if (currentLogLine.Timestamp == null) { ++NoTimestamp.LogLineCount; } ++Total.LogLineCount; }
public void InfoLogLevel() => Assert.Equal("info", LogLine.LogLevel("[INFO]: Timezone changed"));
private void AddEntry(string message) { var index = _entries.Count; var entry = new LogLine(index, index, message, LevelFlags.None); _entries.Add(entry); _listeners.OnRead(_entries.Count); }
public void Parse_unknown() { Assert.Equal(LogLevel.Unknown, LogLine.ParseLogLevel("[XYZ]: Gibberish message.. beep boop..")); }