switch from pringln to using logging functions, enable file logging, turn on fancy colour as the auto-detect doesn't seem to work in my terminal (but the colour does) - wonder if I can fix the auto-detected rather than force the colour?
This commit is contained in:
parent
06cb88f738
commit
bb5d51b3c7
3 changed files with 18 additions and 8 deletions
|
|
@ -7,8 +7,10 @@ import org.springframework.web.bind.annotation.ModelAttribute;
|
|||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.ui.Model;
|
||||
import java.util.List;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@Controller
|
||||
@Slf4j
|
||||
public class BotController {
|
||||
|
||||
@Autowired
|
||||
|
|
@ -16,7 +18,7 @@ public class BotController {
|
|||
|
||||
@GetMapping("/viewbot")
|
||||
public String listAll(Model model) {
|
||||
System.out.println("WebHandler::viewbot");
|
||||
log.info("WebHandler::viewbot");
|
||||
|
||||
List<Bot> botlist = botRepo.findAll();
|
||||
model.addAttribute("bots", botlist);
|
||||
|
|
@ -26,7 +28,7 @@ public class BotController {
|
|||
|
||||
@GetMapping("/makebot")
|
||||
public String makebotget(Model model) {
|
||||
System.out.println("WebHandler::makebot");
|
||||
log.info("WebHandler::makebot");
|
||||
|
||||
Bot bot = new Bot();
|
||||
model.addAttribute("bot", bot);
|
||||
|
|
@ -36,7 +38,7 @@ public class BotController {
|
|||
|
||||
@PostMapping("/makebot")
|
||||
public String makebotpost(@ModelAttribute("bot") Bot bot) {
|
||||
System.out.println(bot);
|
||||
//log.info(bot);
|
||||
|
||||
botRepo.save(bot);
|
||||
|
||||
|
|
|
|||
|
|
@ -3,11 +3,15 @@ package dev.activitypub.activitypubbot;
|
|||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import java.time.Instant;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
|
||||
/**
|
||||
* Here we handle all non-JSON/REST requests - i.e. the normal "web" view
|
||||
*/
|
||||
@Controller
|
||||
@Slf4j
|
||||
public class WebHandler {
|
||||
|
||||
@Autowired
|
||||
|
|
@ -19,12 +23,12 @@ public class WebHandler {
|
|||
*/
|
||||
@RequestMapping("/@springbot")
|
||||
public String atactor() {
|
||||
System.out.println("WebHandler::atactor");
|
||||
log.info("WebHandler::atactor");
|
||||
return this.actor();
|
||||
}
|
||||
@RequestMapping("/users/springbot")
|
||||
public String actor() {
|
||||
System.out.println("WebHandler::actor");
|
||||
log.info("WebHandler::actor");
|
||||
return "index"; // just flinging out the index page for now
|
||||
}
|
||||
|
||||
|
|
@ -33,19 +37,19 @@ public class WebHandler {
|
|||
*/
|
||||
@RequestMapping("/")
|
||||
public String root() {
|
||||
System.out.println("WebHandler::root");
|
||||
log.info("WebHandler::root");
|
||||
return "index";
|
||||
}
|
||||
/*
|
||||
// TODO: presumably there is some way to map things like /<string> to capture string and attempt to resolve template
|
||||
@RequestMapping("/viewbot")
|
||||
public String viewbot() {
|
||||
System.out.println("WebHandler::viewbot");
|
||||
log.info("WebHandler::viewbot");
|
||||
return "viewbot";
|
||||
}
|
||||
@RequestMapping("/makebot")
|
||||
public String makebot() {
|
||||
System.out.println("WebHandler::makebot");
|
||||
log.info("WebHandler::makebot");
|
||||
return "makebot";
|
||||
}
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -2,6 +2,10 @@ spring.application.name=activitypubbot
|
|||
springbot.domain=springbot.seth.id.au
|
||||
springbot.scheme=https
|
||||
|
||||
logging.file.name=logs/springbot.log
|
||||
logging.file.path=logs
|
||||
spring.output.ansi.enabled=ALWAYS
|
||||
|
||||
spring.mvc.view.prefix: /WEB-INF/views/
|
||||
spring.mvc.view.suffix: .jsp
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue