less logs

This commit is contained in:
Anton Martynenko
2025-11-19 18:18:19 +01:00
parent eff7ca4dba
commit 48ebad0609
7 changed files with 3 additions and 314 deletions
@@ -41,12 +41,6 @@ public class RouteService : IRouteService
throw new ArgumentException("Route name is required");
}
_logger.LogInformation("Creating route {RouteId} with {PointCount} original points and {GeofenceCount} geofences",
request.Id, request.Points.Count, request.Geofences?.Polygons?.Count ?? 0);
_logger.LogInformation("Route {RouteId} - Input coordinates: First point ({Lat}, {Lon}), Last point ({LastLat}, {LastLon})",
request.Id, request.Points[0].Latitude, request.Points[0].Longitude,
request.Points[^1].Latitude, request.Points[^1].Longitude);
var allPoints = new List<RoutePointDto>();
var totalDistance = 0.0;
@@ -81,12 +75,6 @@ public class RouteService : IRouteService
DistanceFromPrevious = distanceFromPrevious
};
if (segmentIndex == 0 || segmentIndex == request.Points.Count - 1)
{
_logger.LogInformation("Route {RouteId} - Creating {PointType} point: Lat={Lat:F12}, Lon={Lon:F12}",
request.Id, pointType, routePointDto.Latitude, routePointDto.Longitude);
}
allPoints.Add(routePointDto);
if (!isEnd)
@@ -96,9 +84,6 @@ public class RouteService : IRouteService
var endGeo = new GeoPoint(nextPoint.Latitude, nextPoint.Longitude);
var intermediatePoints = GeoUtils.CalculateIntermediatePoints(startGeo, endGeo, MAX_POINT_SPACING_METERS);
_logger.LogInformation("Segment {SegmentIndex}: Adding {Count} intermediate points",
segmentIndex, intermediatePoints.Count);
foreach (var intermediateGeo in intermediatePoints)
{
@@ -121,9 +106,6 @@ public class RouteService : IRouteService
}
}
_logger.LogInformation("Route {RouteId}: Total {TotalPoints} points (original + intermediate), distance {Distance:F2}m",
request.Id, allPoints.Count, totalDistance);
var now = DateTime.UtcNow;
var routeEntity = new RouteEntity
{
@@ -154,18 +136,11 @@ public class RouteService : IRouteService
DistanceFromPrevious = p.DistanceFromPrevious,
CreatedAt = now
}).ToList();
_logger.LogInformation("Route {RouteId} - Saving {Count} route points to DB. First: Lat={Lat:F12}, Lon={Lon:F12}, Last: Lat={LastLat:F12}, Lon={LastLon:F12}",
request.Id, pointEntities.Count, pointEntities[0].Latitude, pointEntities[0].Longitude,
pointEntities[^1].Latitude, pointEntities[^1].Longitude);
await _routeRepository.InsertRoutePointsAsync(pointEntities);
if (request.Geofences?.Polygons != null && request.Geofences.Polygons.Count > 0)
{
_logger.LogInformation("Route {RouteId}: Processing {GeofenceCount} geofence polygons",
request.Id, request.Geofences.Polygons.Count);
for (int polygonIndex = 0; polygonIndex < request.Geofences.Polygons.Count; polygonIndex++)
{
var polygon = request.Geofences.Polygons[polygonIndex];
@@ -195,16 +170,10 @@ public class RouteService : IRouteService
}
var geofenceRegions = CreateGeofenceRegionGrid(polygon.NorthWest, polygon.SouthEast, request.RegionSizeMeters);
_logger.LogInformation("Route {RouteId}: Polygon {PolygonIndex} - Created grid of {Count} regions to cover geofence area",
request.Id, polygonIndex, geofenceRegions.Count);
foreach (var geofencePoint in geofenceRegions)
{
var geofenceRegionId = Guid.NewGuid();
_logger.LogInformation("Route {RouteId}: Polygon {PolygonIndex} - Requesting geofence region {RegionId} at ({Lat}, {Lon}) with size {Size}m",
request.Id, polygonIndex, geofenceRegionId, geofencePoint.Lat, geofencePoint.Lon, request.RegionSizeMeters);
await _regionService.RequestRegionAsync(
geofenceRegionId,
@@ -219,14 +188,6 @@ public class RouteService : IRouteService
}
}
if (request.RequestMaps)
{
_logger.LogInformation("Route {RouteId}: Maps requested. Regions will be processed sequentially by background service.",
request.Id);
}
_logger.LogInformation("Route {RouteId} created successfully", request.Id);
return new RouteResponse
{
Id = routeEntity.Id,