Skip to content

Commit ccc136a

Browse files
Log when using inline functions
1 parent c0977ab commit ccc136a

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/main/java/com/broadcom/tanzu/demos/springai101/weather/WeatherV1Controller.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616

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

19+
import org.slf4j.Logger;
20+
import org.slf4j.LoggerFactory;
1921
import org.springframework.ai.chat.client.ChatClient;
2022
import org.springframework.http.MediaType;
2123
import org.springframework.web.bind.annotation.GetMapping;
@@ -26,6 +28,7 @@
2628

2729
@RestController
2830
class WeatherV1Controller {
31+
private final Logger logger = LoggerFactory.getLogger(WeatherV1Controller.class);
2932
private final WeatherService weatherService;
3033
private final ChatClient chatClient;
3134

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

0 commit comments

Comments
 (0)