public async Task LogRequest <TReq>(Guid correlationId, string serviceName, TReq request) where TReq : new() { var msg = await _logObjectSerializer.Serialize(request); await _bus.PubSub.PublishAsync(new ServiceLogMessage { CorrelationId = correlationId, Event = "Request", Service = serviceName, Message = msg }); }
public LogEntry CreateLogEntry(Guid softwareId) { if (Message != null && Object != null) { return(new LogEntry { SoftwareId = softwareId, Level = Level, Object = _serializer.Serialize(new MessageAndObjectLog(Message, Object)), ObjectType = typeof(MessageAndObjectLog).FullName }); } if (Message != null) { return(new LogEntry { SoftwareId = softwareId, Level = Level, Object = Message, ObjectType = typeof(string).FullName }); } if (Object != null) { return(new LogEntry { SoftwareId = softwareId, Level = Level, Object = Object == null ? null : _serializer.Serialize(Object), ObjectType = Object?.GetType().FullName }); } return(new LogEntry { SoftwareId = softwareId, Level = Level, Object = "Empty Log Entry", ObjectType = typeof(string).FullName }); }
public async Task LogRequest <TReq>(Guid correlationId, string serviceName, TReq request) where TReq : new() { var data = await _logObjectSerializer.Serialize(request); _logger.LogInformation("Request: {serviceName}:{correlationId} {data}", serviceName, correlationId, data); }
public void Log(object o) { Logger.Info(_serializer.Serialize(o)); }