Skip to content
This repository has been archived by the owner on Apr 27, 2020. It is now read-only.

Commit

Permalink
Added even more debug output to HTMLExporter. References #33, #16.
Browse files Browse the repository at this point in the history
  • Loading branch information
fabianonline committed Nov 25, 2016
1 parent 4b92d63 commit 4ef11a1
Showing 1 changed file with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import de.fabianonline.telegram_backup.UserManager;
import de.fabianonline.telegram_backup.Database;
import de.fabianonline.telegram_backup.Utils;

import java.io.File;
import java.io.PrintWriter;
Expand Down Expand Up @@ -96,8 +97,11 @@ public void export(UserManager user) {

mustache = mf.compile("templates/html/chat.mustache");

logger.debug("Generating dialog pages");
int i=0;
logger.debug("Generating {} dialog pages", dialogs.size());
for (Database.Dialog d : dialogs) {
i++;
logger.trace("Dialog {}/{}: {}", i, dialogs.size(), Utils.anonymize(""+d.id));
LinkedList<HashMap<String, Object>> messages = db.getMessagesForExport(d);
scope.clear();
scope.put("user", user);
Expand All @@ -114,8 +118,11 @@ public void export(UserManager user) {
w.close();
}

logger.debug("Generating chat pages");
i=0;
logger.debug("Generating {} chat pages", chats.size());
for (Database.Chat c : chats) {
i++;
logger.trace("Chat {}/{}: {}", i, chats.size(), Utils.anonymize(""+c.id));
LinkedList<HashMap<String, Object>> messages = db.getMessagesForExport(c);
scope.clear();
scope.put("user", user);
Expand All @@ -137,14 +144,15 @@ public void export(UserManager user) {
URL cssFile = getClass().getResource("/templates/html/style.css");
File dest = new File(base + "style.css");
FileUtils.copyURLToFile(cssFile, dest);
logger.debug("Done exporting.");
} catch (IOException e) {
e.printStackTrace();
throw new RuntimeException("Exception above!");
}
}

private OutputStreamWriter getWriter(String filename) throws FileNotFoundException {
logger.trace("Creating writer for file {}", filename);
logger.trace("Creating writer for file {}", Utils.anonymize(filename));
return new OutputStreamWriter(new FileOutputStream(filename), Charset.forName("UTF-8").newEncoder());
}

Expand Down

0 comments on commit 4ef11a1

Please sign in to comment.