Add more logging

main
ilitirit 1 year ago
parent d9f08a67a0
commit 6105062500

@ -78,6 +78,9 @@ namespace Expedience.Api.Consumers
}
// Insert this territory if it does not exist
_logger.LogInformation("Checking if territory {territoryId} - {contentName} exists",
completionResult.TerritoryId, message.DutyInfo.ContentName);
var territory = dbContext.Territories.FirstOrDefault(t => t.TerritoryId == completionResult.TerritoryId);
if (territory == null)
{
@ -92,14 +95,17 @@ namespace Expedience.Api.Consumers
Level = 0,
});
}
else if (String.IsNullOrWhiteSpace(territory.ContentName))
else
{
_logger.LogInformation("Updating territory {territoryId} with content name {contentName} and place name {placeName}",
completionResult.TerritoryId, message.DutyInfo.ContentName, message.DutyInfo.PlaceName);
// Update the place/content name if necessary
territory.ContentName = message.DutyInfo.ContentName;
territory.PlaceName = message.DutyInfo.PlaceName;
_logger.LogInformation("Territory with Id {territoryId} with name {contentName}", territory.TerritoryId, territory.ContentName);
if (String.IsNullOrWhiteSpace(territory.ContentName))
{
_logger.LogInformation("Updating territory {territoryId} with content name {contentName} and place name {placeName}",
completionResult.TerritoryId, message.DutyInfo.ContentName, message.DutyInfo.PlaceName);
// Update the place/content name if necessary
territory.ContentName = message.DutyInfo.ContentName;
territory.PlaceName = message.DutyInfo.PlaceName;
}
}
await dbContext.SaveChangesAsync();

Loading…
Cancel
Save