Skip to content

Commit

Permalink
Log when using inline functions
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandreroman committed Jun 11, 2024
1 parent c0977ab commit ccc136a
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

package com.broadcom.tanzu.demos.springai101.weather;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.ai.chat.client.ChatClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
Expand All @@ -26,6 +28,7 @@

@RestController
class WeatherV1Controller {
private final Logger logger = LoggerFactory.getLogger(WeatherV1Controller.class);
private final WeatherService weatherService;
private final ChatClient chatClient;

Expand All @@ -44,6 +47,7 @@ String weather(@RequestParam("city") String city) {
new Function<ByCityRequest, Weather>() {
@Override
public Weather apply(ByCityRequest req) {
logger.info("Loading weather from {} using OpenWeatherMap in inline function", req.city());
return weatherService.getWeatherByCity(req.city());
}
})
Expand Down

0 comments on commit ccc136a

Please sign in to comment.