Skip to content

Commit

Permalink
Add logging to template
Browse files Browse the repository at this point in the history
  • Loading branch information
Strohgelaender committed Jul 8, 2022
1 parent e9a5814 commit 19a894b
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/main/java/de/tum/in/ase/eist/AnswerResource.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package de.tum.in.ase.eist;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
Expand All @@ -11,6 +13,8 @@
@RequestMapping(value = "api", produces = {MediaType.TEXT_PLAIN_VALUE})
public class AnswerResource {

private final Logger logger = LoggerFactory.getLogger(AnswerResource.class);

private final QueryProcessor queryProcessor;

public AnswerResource(QueryProcessor queryProcessor) {
Expand All @@ -19,6 +23,7 @@ public AnswerResource(QueryProcessor queryProcessor) {

@GetMapping("*")
public ResponseEntity<String> answer(@RequestParam("q") String query) {
logger.info("Received query \"{}\"", query);
String answer = queryProcessor.process(query);
return ResponseEntity.ok(answer);
}
Expand Down

0 comments on commit 19a894b

Please sign in to comment.