add logging when we make a network request for geocoding through OSM
All checks were successful
Generic zig build / build (push) Successful in 1m15s
Generic zig build / deploy (push) Successful in 12s

This commit is contained in:
Emil Lerch 2026-01-05 14:21:17 -08:00
parent 7d72c2e8c1
commit 83ce3afe58
Signed by: lobo
GPG key ID: A7B62D657EF764F8

View file

@ -4,6 +4,8 @@ const GeoCache = @import("GeoCache.zig");
const Airports = @import("Airports.zig");
const Coordinates = @import("../Coordinates.zig");
const log = std.log.scoped(.resolver);
pub const Location = struct {
name: []const u8,
coords: Coordinates,
@ -92,6 +94,7 @@ pub const Resolver = struct {
};
}
log.info("Calling nominatim (OpenStreetMap) to resolve place name {s} to coordinates", .{name});
// Call Nominatim API
const url = try std.fmt.allocPrint(
self.allocator,
@ -142,6 +145,7 @@ pub const Resolver = struct {
const display_name = first.object.get("display_name").?.string;
const lat = try std.fmt.parseFloat(f64, first.object.get("lat").?.string);
const lon = try std.fmt.parseFloat(f64, first.object.get("lon").?.string);
log.info("nominatim resolved place name {s} to {}, {}", .{ name, lat, lon });
// Cache the result
try self.geocache.put(name, .{