private void LogMessage(string message) { if (Log != null && message != null) { Log.WriteLine(message); } Debug.WriteLine(message); LogEventReceived?.Invoke(this, new LogEventArgs(message)); }
public Task PurgeAndRecordLogEvent([FromBody] LogEventsModel logEvents) { var command = LogEventReceived.Purge(_context.DeviceId); if (logEvents != null) { command = LogEventReceived.HavingDetails( _context.DeviceId, logEvents, purgeExisting: true); } return(_messagingSrv.SendAsync(command)); }
public async Task When(LogEventReceived command) { // Create a new device log domain entity from received command. var deviceLog = DeviceLog.ForExistingDevice(command.DeviceId); foreach (LogEventModel model in command.LogEvents) { var logEvent = new ApplicationLog { Type = model.Type, Message = model.Content, CreatedLocal = model.TimestampLocal, CreatedUtc = model.TimestampUtc }; deviceLog.AddLog(logEvent); } // Save the device log and optionally delete any prior entries. using (_repoContext) { await _deviceRepository.WriteDeviceLog(deviceLog, command.PurgeExisting); } }
public Task RecordLogEvent([FromBody] LogEventsModel logEvents) { var command = LogEventReceived.HavingDetails(_context.DeviceId, logEvents); return(_messagingSrv.SendAsync(command)); }