Added some minor logging functionality using log4j
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
2022-05-06 02:58:50 -04:00
parent a977ff8cfe
commit a8302c38e0
7 changed files with 46 additions and 9 deletions

View File

@ -1,5 +1,6 @@
package tech.bitgoblin.transcoder;
import tech.bitgoblin.Logger;
import tech.bitgoblin.io.IOUtils;
import java.io.File;
@ -33,7 +34,7 @@ public class Repository {
// searches this ingest directory for video files
public File[] searchIngest() {
System.out.println("Searching for files to transcode in " + this.ingestPath);
Logger.logger.info("Searching for files to transcode in " + this.ingestPath);
File repo = new File(this.ingestPath);
return repo.listFiles();
}

View File

@ -10,6 +10,7 @@ import java.nio.file.Paths;
import java.nio.file.StandardCopyOption;
import java.util.Timer;
import tech.bitgoblin.Logger;
import tech.bitgoblin.config.Config;
import tech.bitgoblin.io.IOUtils;
@ -46,12 +47,12 @@ public class Transcoder {
// check if the ingest directory is empty
if (sourceFiles.length == 0) {
System.out.println("There is nothing to transcode in ingest.");
Logger.logger.info("There is nothing to transcode in ingest.");
return;
}
// transcode
System.out.println("Transcoding video files ingest...");
Logger.logger.info("Transcoding video files ingest...");
for (File f : sourceFiles) {
String filePath = f.toString().substring(0, f.toString().lastIndexOf("."));
String filename = Paths.get(filePath).getFileName().toString();
@ -73,16 +74,16 @@ public class Transcoder {
try {
Process process = pb.start();
int ret = process.waitFor();
System.out.printf("Program exited with code: %d\n", ret);
System.out.println();
Logger.logger.info("Program exited with code: %d", ret);
Logger.logger.info("");
} catch (IOException | InterruptedException e) {
throw new RuntimeException(e);
}
}
// end output
System.out.println("------------ End of transcoding ------------");
System.out.println();
Logger.logger.info("------------ End of transcoding ------------");
Logger.logger.info("");
}
}