#pragma warning disable CS0114 public void AddText(string text) #pragma warning restore CS0114 { Dispatcher.BeginInvoke((Action)(() => LogEntries.Add(new LogEntry() { Index = IndexTotal++, Message = text }))); }
private ResponseMessage RequestsGet(RequestMessage requestMessage) { var result = LogEntries .Where(r => !r.RequestMessage.Path.StartsWith("/__admin/")) .Select(ToLogEntryModel); return(ToJson(result)); }
public void OrdinaryPage() { var page = Go.To <OrdinaryPage>(url: "Input.html"); Assert.That(LogEntries.Last().Message, Is.EqualTo("Go to \"<ordinary>\" page")); page.PageTitle.Should.StartWith("Input"); }
private async Task LogToScreen() { var memoryLogger = new MemoryLogger(); await PostData(memoryLogger); LogEntries.AddRange(memoryLogger.LogEntries.SelectMany(x => x.Split(Environment.NewLine.ToCharArray()))); }
private void DeleteLogEntry(LogEntryDataModel aLogEntry) { if (ConfirmDelete() == MessageBoxResult.Yes) { LogEntries.Remove(aLogEntry); CollectionIsDirty = true; } }
/// <summary> /// Add random log entry to the ViewList evoked by a timer. /// </summary> private void AddRandomEntry() { Dispatcher.BeginInvoke((Action)(() => { LogEntries.Add(GetRandomEntry()); LogList.ScrollIntoView(LogList.Items[LogList.Items.Count - 1]); })); }
public void Create() { using (var sut = new LogEntries(FileName)) { sut.Count().Should().Be(ExpectedEntryCount); sut.ToList(); } }
public void AddEntry(LogEntry en) { if (en.Index > IndexTotal) { Dispatcher.BeginInvoke((Action)(() => LogEntries.Add(en))); IndexTotal = en.Index; } }
LogEntryViewModel FindNextBookMark(object startFrom, bool skipStartItem) { int skip = skipStartItem ? 1 : 0; var next = LogEntries.SkipWhile(le => le != startFrom) .Skip(skip) .FirstOrDefault(le => le.Bookmarked); return(next); }
private async void LogUpdated(HttpEventData data) { await _dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { LogEntries.Add(new EventData { Data = data }); }); }
public override void Create() { if (LogEntries.HasErrors()) { throw new Exception("Please fix compile errors first"); } var files = AssetDb.FindByLabel("BuildNewService"); using (var assets = AssetEditor.Instance) { var assetNames = new List <string>(); foreach (string filePath in files) { var dir = Path.GetDirectoryName(filePath); var assetName = Path.GetFileNameWithoutExtension(filePath); var scriptPath = $"{dir}/{assetName}.cs"; var monoScript = AssetDb.Load <MonoScript>(scriptPath); var assetPath = $"{dir}/{assetName}.asset"; if (!File.Exists(assetPath)) { Debug.Log($"Building {assetPath}"); assetNames.Add(assetName); var match = namespaceRegex.Match(monoScript.text); var nameSpace = match.Success ? match.Groups[1].Value : ""; assets.Add(assetName, nameSpace, assetPath); } AssetDatabase.ClearLabels(monoScript); } Environment mockEnvironment = AssetDatabase.LoadAssetAtPath <Environment>("Assets/Askowl/Decoupler/Scripts/Environments/Mock.asset"); foreach (var assetName in assetNames) { var assetPath = assets.AssetPath(assetName); var path = Path.GetDirectoryName(assetPath); var nameBase = Path.GetFileNameWithoutExtension(path); switch (assets.Asset(assetName)) { case IServicesManager _: assets .SetFieldToAssetEditorEntry(assetName, "context", $"{nameBase}Context") .InsertIntoArrayField(assetName, "services", $"{nameBase}ServiceForMock"); break; case IContext _: assets.SetField(assetName, "environment", mockEnvironment); break; case IServiceAdapter _: // var contextName = $"{nameBase}Context"; // if (!assets.Exists(contextName)) assets.Load(contextName, Namespace(assetPath), path); // assets.SetFieldToAssetEditorEntry(assetName, "context", $"{nameBase}Context"); break; } } } }
public static void AddEntry(string name, string locator, int seconds, int miliseconds) { var newEntry = new LogEntries(); newEntry.ElementName = name; newEntry.ElementLocator = locator; newEntry.SecondsToLocate = seconds; newEntry.MilisecondsToLocate = miliseconds; LogEvents.Add(newEntry); }
private void setupNewLog() { LogEntries.Clear(); CollectionIsDirty = true; LogOnDisk = false; logName = "New Log"; setWindowTitle(); }
private void ScrollToBottom() { var items = LogEntries.Items; if (items.Count > 0) { LogEntries.ScrollIntoView(items[items.Count - 1]); } }
private static void VerifyLogMessageEquals( LogEntries logEntries, string logMessage) { var result = logEntries.LoggedItems.FirstOrDefault(); Assert.NotNull(result); Assert.Equal(logMessage, result); }
public void SetStatus(int status) { LogEntries.Add(status); objStatus = status; if (OnStatusChanged != null) { OnStatusChanged(status); } }
public override void Validate(out string[] ErrorPriorityArray, out string[] ErrorMessageArray) { ErrorPriorityArray = null; ErrorMessageArray = null; string errorPriority = Convert.ToString(Arguments.GetArgument(0)); GTValidationLogger gTValidationLogger = null; if (new gtLogHelper().CheckIfLoggingIsEnabled()) { LogEntries logEntries = new LogEntries { ActiveComponentName = Convert.ToString(ActiveFeature.CNO), ActiveFID = ActiveFeature.FID, ActiveFieldName = "N/A", ActiveFieldValue = "N/A", JobID = DataContext.ActiveJob, RelatedComponentName = Convert.ToString(RelatedCNO), RelatedFID = 0, RelatedFieldName = "N/A", RelatedFieldValue = "N/A", ValidationInterfaceName = "Voltage Agreement", ValidationInterfaceType = "RGI" }; gTValidationLogger = new GTValidationLogger(logEntries); gTValidationLogger.LogEntry("TIMING", "START", "Voltage Agreement Entry", "N/A", ""); } try { IGTApplication gtApplication = GTClassFactory.Create <IGTApplication>(); gtApplication.SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, "Voltage Agreement Validation Started"); SetAffectedRelatedNodeVoltages(errorPriority); if (m_lstErrorMessage.Count > 0) { ErrorMessageArray = m_lstErrorMessage.ToArray(); ErrorPriorityArray = m_lstErrorPriority.ToArray(); } gtApplication.SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, "Voltage Agreement Validation Completed"); if (gTValidationLogger != null) { gTValidationLogger.LogEntry("TIMING", "END", "Voltage Agreement Exit", "N/A", ""); } } catch (Exception ex) { throw new Exception("Error in Voltage Agreement Relationship Geometry Interface-Validate: " + ex.Message); } }
public void InquiryResponse_response( Command command, byte[] expectedData, object?expectedResponse, LogLevel expectedLogLevel, string?expectedLogMessage) { var response = command.GetResponse(expectedData, Logger); Assert.Equal(1, response.DeviceId); Assert.Equal(0, response.Socket); if (command.Type == CommandType.Inquiry) { if (expectedLogLevel != LogLevel.None) { if (expectedLogLevel >= LogLevel.Error) { Assert.False(response.IsValid); Assert.Equal(ResponseType.Unknown, response.Type); } else { Assert.True(response.IsValid); Assert.Equal(ResponseType.Inquiry, response.Type); } // Check for log Assert.Equal(1, LogEntryCount); var lastLog = LogEntries.Last(); Assert.Equal(expectedLogLevel, lastLog.LogLevel); Assert.Equal(expectedLogMessage, lastLog.Message); } else { Assert.True(response.IsValid); Assert.Equal(ResponseType.Inquiry, response.Type); Assert.Equal(0, LogEntryCount); } // Check result Assert.Equal(expectedResponse, response.ResultObject); return; } Assert.False(response.IsValid); Assert.Equal(ResponseType.Unknown, response.Type); // Check for error Assert.Equal(1, LogEntryCount); var error = LogEntries.Last(); Assert.Equal(LogLevel.Error, error.LogLevel); Assert.Equal( $"The '{nameof(ResponseType.Inquiry)}' response was not expected for the '{command.Type}' type.", error.Message); }
public void OnLog(DateTime stamp, string msg, LogLevel level) { System.Windows.Application.Current.Dispatcher.BeginInvoke(new Action(() => LogEntries.Add(new LogItem { Stamp = stamp, Msg = msg, Level = level })), DispatcherPriority.Background); }
public void Load(Box box) { Cards.AddRange(box.Cards.Select(x => mapper.Map <Card, CardViewModel>(x))); Columns.AddRange(box.Columns.Select(x => mapper.Map <Column, ColumnViewModel>(x))); Rows.AddRange(box.Rows.Select(x => mapper.Map <Row, RowViewModel>(x))); Boards.AddRange(box.Boards.Select(x => mapper.Map <Board, BoardViewModel>(x))); LogEntries.AddRange(box.Log.Select(x => mapper.Map <Kamban.Repository.Models.LogEntry, LogEntryViewModel>(x))); Loaded = true; }
public void AddEntry(string logName, string logEntry) { LogEntries logEntries; if (!_logs.TryGetValue(logName, out logEntries)) { _logs.Add(logName, logEntries = new LogEntries()); } logEntries.AddEntry(logEntry); }
public string Log(string message) { LogEntries.Add(new LogEntry { DateTime = DateTime.Now, Message = message, Index = ++messageCounter }); #if DEBUG Console.WriteLine(message); #endif return(message); }
public MainWindowViewModel() { _random = new Random(); _words = _testData.Split(' ').ToList(); _maxword = _words.Count - 1; Enumerable.Range(0, 200000).ToList().ForEach(x => LogEntries.Add(GetRandomEntry())); _timer = new Timer(x => AddRandomEntry(), null, 1000, 10); }
/// <summary> /// Creates a new object that is a copy of the current instance. /// </summary> /// <returns>A new object that is a copy of this instance.</returns> public object Clone() { var ret = new TextMarker(LogEntries.ToList(), Author, Message); ret.Uid = Uid; // Implement exact clone ret.DateCreation = DateCreation; ret.DateLastModification = DateLastModification; return(ret); }
private void QueueStarted(object sender, EventArgs eventArgs) { //throw new NotImplementedException(); LogEntries.Add(new LogEntry { EntryTime = DateTime.Now, JobName = "Queue", LogText = "Queue Started" }); }
LogEntryViewModel FindPreviousBookMark(object startFrom, bool skipStartItem) { int skip = skipStartItem ? 1 : 0; var prev = LogEntries.Reverse() .SkipWhile(le => le != startFrom) .Skip(skip) .FirstOrDefault(le => le.Bookmarked); return(prev); }
/// <summary> /// Method for Validate. /// </summary> private void ProcessValidate(out string[] ErrorPriorityArray, out string[] ErrorMessageArray) { try { ErrorPriorityArray = null; ErrorMessageArray = null; GTValidationLogger gTValidationLogger = null; if (new gtLogHelper().CheckIfLoggingIsEnabled()) { LogEntries logEntries = new LogEntries { ActiveComponentName = Convert.ToString(m_rgiBaseClass.ActiveFeature.CNO), ActiveFID = m_rgiBaseClass.ActiveFeature.FID, ActiveFieldName = "N/A", ActiveFieldValue = "N/A", JobID = m_rgiBaseClass.DataContext.ActiveJob, RelatedComponentName = Convert.ToString(m_rgiBaseClass.RelatedCNO), RelatedFID = 0, RelatedFieldName = "N/A", RelatedFieldValue = "N/A", ValidationInterfaceName = "Feeder Agreement", ValidationInterfaceType = "RGI" }; gTValidationLogger = new GTValidationLogger(logEntries); gTValidationLogger.LogEntry("TIMING", "START", "Feeder Agreement Entry", "N/A", ""); } IGTApplication gtApplication = GTClassFactory.Create <IGTApplication>(); gtApplication.SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, "Feeder Agreement Validation Started"); ProcessEstablish(); if (m_lstErrorMessage.Count > 0) { ErrorMessageArray = m_lstErrorMessage.ToArray(); ErrorPriorityArray = m_lstErrorPriority.ToArray(); } gtApplication.SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, "Feeder Agreement Validation Completed"); if (gTValidationLogger != null) { gTValidationLogger.LogEntry("TIMING", "END", "Feeder Agreement Exit", "N/A", ""); } } catch { throw; } }
/// <summary> /// Получить строки лог-файла. /// </summary> /// <param name="fileName">Имя файла.</param> /// <returns></returns> public ActionResult GetLogEntries(string fileName) { int pageIndex = int.Parse(this.Request.Params.Get("page")); int pageSize = int.Parse(this.Request.Params.Get("rows")); if (!System.IO.File.Exists(fileName)) { return(new HttpNotFoundResult()); } var totalLineCount = 0; var logEntryList = new List <LogEntry>(); using (var fileStream = new FileStream(fileName, FileMode.Open, FileAccess.Read, FileShare.Read)) { using (var streamReader = new StreamReader(fileStream, Encoding.GetEncoding(1251))) { var skipLineCount = (pageIndex - 1) * pageSize; while (skipLineCount > 0) { streamReader.ReadLine(); skipLineCount--; totalLineCount++; } var currentLine = streamReader.ReadLine(); var pageLineCount = pageSize; while (pageLineCount > 0 && currentLine != null) { var logEntry = new LogEntry(currentLine); logEntryList.Add(logEntry); pageLineCount--; totalLineCount++; currentLine = streamReader.ReadLine(); } while (currentLine != null) { totalLineCount++; currentLine = streamReader.ReadLine(); } } } var logEntries = new LogEntries(); logEntries.rows = new LogEntry[logEntryList.Count]; int index = 0; foreach (var logEntry in logEntryList) { logEntries.rows[index++] = logEntry; } logEntries.page = pageIndex; logEntries.records = totalLineCount; logEntries.total = (int)Math.Ceiling((double)totalLineCount / pageSize); return(this.Json(logEntries, JsonRequestBehavior.AllowGet)); }
void Page_LoadComplete(object sender, EventArgs e) { System.Diagnostics.Debug.WriteLine("----------Page load complete!"); myUser = Account.SecurePage(this, Data.DeviceType, "admin"); List <LogEntry> LogEntries; if (selectedLogId == default) { LogEntries = ParsnipData.Logging.Data.GetAllLogEntries().OrderByDescending(x => x.date).ToList(); } else { Log temp = Log.Select((Log.Ids)selectedLogId); LogEntries = temp.GetLogEntries().OrderByDescending(x => x.date).ToList(); } foreach (LogEntry myEntry in LogEntries) { TableRow MyRow = new TableRow(); MyRow.Attributes.Add("style", "word-wrap:break-word"); MyRow.Cells.Add(new TableCell() { Text = myEntry.date.ToString(), CssClass = "date-cell" }); MyRow.Cells.Add(new TableCell() { Text = myEntry.Text }); LogTable.Rows.Add(MyRow); } EntryCount.Text = string.Format("{0} entries found", LogEntries.Count()); if (Request.QueryString["action"] != null) { string action = Request.QueryString["action"]; if (Request.QueryString["success"] != null) { string success = Request.QueryString["success"]; if (success == "true") { SuccessText.Text = string.Format("<strong>Success</strong> All logs were successfully {0}d on the database!", action); Success.Attributes.CssStyle.Add("display", "block"); } } } UpdateLogList(); SelectLog.SelectedValue = selectedLogId.ToString(); System.Diagnostics.Debug.WriteLine("Page_LoadComplete complete!"); }
public WriteToFile() { logEntries = new LogEntries(); if (File.Exists(SerializeTo)) { logEntries = Serialization.Deserialize<LogEntries>(XDocument.Load(SerializeTo).ToString()); File.Delete(SerializeTo); } }
public ActionResult History(string id) { LogEntries FilteredLog = new LogEntries("clusterlog"); if (!String.IsNullOrEmpty(id)) { FilteredLog.RemoveAll(e => ((Cluster)e.Data["Before"]).Name.ToUpper() != id.ToUpper()); } return(View(FilteredLog)); }
public LogEntries Chronoligical() { LogEntries logEntries = new LogEntries(); logEntries.AddRange(this.Entries.OrderByDescending(logEntry => logEntry.TimeStamp)); return logEntries; }
/// <summary>Default Constructor</summary> public Log() { Entries = new LogEntries(); }
/// <summary> /// Contextual log, important messages and traces. /// </summary> /// <returns>Log Entries</returns> public LogEntries Contextual() { int index = 0; LogEntries logEntries = new LogEntries(); while (logEntries.Count < 200) { if (index >= Entries.Count) break; LogEntry logEntry = Entries[index++]; switch (logEntry.EventType) { case LogEventType.Information: case LogEventType.Warning: logEntries.Add(logEntry); break; case LogEventType.Error: case LogEventType.Critical: logEntries.AddRange(Entries.Skip(index - 10).Take(10).Where(match => !logEntries.Contains(match))); logEntries.AddRange(Entries.Skip(index).Take(10)); index += 10; break; case LogEventType.Trace: default: continue; } } return logEntries; }