Skip to content
This repository has been archived by the owner on Jan 18, 2025. It is now read-only.

Commit

Permalink
Refactor logger initialization
Browse files Browse the repository at this point in the history
  • Loading branch information
powersagitar committed Jan 11, 2025
1 parent cd87c9e commit 3acceef
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,23 @@ public class Mastermind {
public final static Dimension CANVAS_DIMENSION = new Dimension(640, 480);
public final static Logger log = new Logger();

static {
private static void initializeLogger() {
try {
final FileOutputStream logFile = new FileOutputStream("mastermind.log", false);
log.addSink(logFile);
} catch (final FileNotFoundException e) {
log.error("Failed to open log file: " + e.getMessage());
log.error("Failed to open log file output stream: " + e.getMessage());
}
}

public static void main(String[] args) {
initializeLogger();

log.info("Starting Mastermind");
log.debug("Total colors: " + TOTAL_COLORS);
log.debug("Code length: " + CODE_LENGTH);
log.debug("Max guesses: " + MAX_GUESSES);
log.debug("Canvas dimension: " + CANVAS_DIMENSION);

final JFrame frame = Scene.createDefaultScene();
new GameModeSelector(frame);
Expand Down

0 comments on commit 3acceef

Please sign in to comment.