Skip to content

Commit

Permalink
refactor(CreateFilePane): add proper logs
Browse files Browse the repository at this point in the history
  • Loading branch information
yarl committed May 5, 2017
1 parent 729ff48 commit 9428e1f
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions src/pattypan/panes/CreateFilePane.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
import java.util.logging.Logger;
import javafx.scene.control.Hyperlink;
import javafx.scene.layout.Region;
import javafx.scene.text.Text;
import javafx.scene.text.TextAlignment;
import javafx.scene.text.TextFlow;
import javafx.stage.Stage;
Expand All @@ -61,6 +60,8 @@

public class CreateFilePane extends WikiPane {

private static final Logger LOGGER = Logger.getLogger(CreateFilePane.class.getName());

Stage stage;

WikiLabel descLabel;
Expand Down Expand Up @@ -107,7 +108,10 @@ private WikiPane setActions() {
Settings.saveProperties();
} catch (IOException | BiffException | WriteException ex) {
addElement(new WikiLabel("create-file-error"));
Logger.getLogger(CreateFilePane.class.getName()).log(Level.SEVERE, null, ex);
LOGGER.log(Level.WARNING,
"Error occurred during creation of spreadsheet file: {0}",
new String[]{ex.getLocalizedMessage()}
);
}
});

Expand All @@ -123,7 +127,10 @@ private void showOpenFileButton() {
try {
Desktop.getDesktop().open(Session.FILE);
} catch (IOException ex) {
Logger.getLogger(CreateFilePane.class.getName()).log(Level.SEVERE, null, ex);
LOGGER.log(Level.WARNING,
"Cannot open file: {0}",
new String[]{ex.getLocalizedMessage()}
);
}
});

Expand Down Expand Up @@ -229,7 +236,10 @@ private String getExifDate(File file) {
return "";
}
} catch (ImageProcessingException | IOException ex) {
Logger.getLogger(CreateFilePane.class.getName()).log(Level.SEVERE, null, ex);
LOGGER.log(Level.INFO,
"Exif error for {0}: {1}",
new String[]{file.getName(), ex.getLocalizedMessage()}
);
return "";
}
}
Expand Down

0 comments on commit 9428e1f

Please sign in to comment.