Skip to content

Commit

Permalink
Add logging to reading a meta file
Browse files Browse the repository at this point in the history
  • Loading branch information
tochi-y committed Aug 10, 2019
1 parent 774da0d commit 1120e74
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -197,9 +197,18 @@ public void load() {
* load from the file.
*/
private void doLoad() throws PersoniumCoreException {
// write start log
PersoniumCoreLog.Dav.FILE_OPERATION_START.params(file.toPath()).writeLog();
ElapsedTimeLog endLog = ElapsedTimeLog.Dav.FILE_OPERATION_END.params();
endLog.setStartTime();

try (Reader reader = Files.newBufferedReader(file.toPath(), Charsets.UTF_8)) {
JSONParser parser = new JSONParser();
this.json = (JSONObject) parser.parse(reader);
// write end log
int jsonSize = this.json.toJSONString().getBytes(Charsets.UTF_8).length;
endLog.setParams(jsonSize / KILO_BYTES);
endLog.writeLog();
} catch (IOException | ParseException e) {
// IO failure or JSON is broken
throw PersoniumCoreException.Dav.DAV_INCONSISTENCY_FOUND.reason(e);
Expand Down

0 comments on commit 1120e74

Please sign in to comment.