Add beautiful output

This commit is contained in:
2020-10-25 14:33:49 +01:00
parent 6579d3c003
commit d8e70fb1b0
10 changed files with 93 additions and 39 deletions

View File

@@ -5,9 +5,10 @@ import net.sourceforge.argparse4j.ArgumentParsers;
import net.sourceforge.argparse4j.inf.ArgumentParser;
import net.sourceforge.argparse4j.inf.ArgumentParserException;
import net.sourceforge.argparse4j.inf.Namespace;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.ThreadContext;
import org.apache.logging.log4j.core.config.Configurator;
/**
* Hello world!
@@ -22,13 +23,15 @@ public class App {
private static Logger logger = LogManager.getLogger(App.class);
public static void main(String[] args) throws Exception {
ThreadContext.put("myLogLvl", "INFO");
Configurator.setRootLevel(Level.INFO);
initOptions(args);
String sql = "";
String beautifulInfo = "";
switch(mode) {
case "MatchdaysUpdater":
TLWMatchdaysUpdater matchdaysUpdater = new TLWMatchdaysUpdater(season, league, configFile);
sql = matchdaysUpdater.getUpdateSql();
beautifulInfo = matchdaysUpdater.getBeautifulInfo();
break;
case "MatchesCreatorFootball":
TLWMatchesCreatorFootball creator = new TLWMatchesCreatorFootball(season, league, configFile);
@@ -37,6 +40,7 @@ public class App {
case "MatchesUpdaterFootball":
TLWMatchesUpdaterFootball tlwMatchesUpdaterFootball = new TLWMatchesUpdaterFootball(season, league, configFile);
sql = tlwMatchesUpdaterFootball.getUpdateSQL();
beautifulInfo = tlwMatchesUpdaterFootball.getBeautifulInfo();
break;
case "TeamsUpdater":
TLWTeamsUpdater teamsUpdater = new TLWTeamsUpdater(season, league, configFile);
@@ -47,17 +51,11 @@ public class App {
default:
break;
}
if (sql.equals("")) {
logger.info("No updates for season " + season + ", league " + league + ", config " + configFile);
} else {
logger.info("Executed query:\n" + sql);
}
if(!StatusHolder.getError() && !sql.equals("")) {
TippligaSQLConnector con = new TippligaSQLConnector();
// con.executeUpdate(sql);
logger.info(beautifulInfo);
}
logger.error("testerror");
logger.info("testinfo");
if(StatusHolder.getError()) {
System.exit(1);
}