Skip to content

Commit

Permalink
Check Log File opening
Browse files Browse the repository at this point in the history
like we do with the fenFile, check Log file on creation.

closes official-stockfish#2365

No functional change.
  • Loading branch information
vondele committed Oct 21, 2019
1 parent 12d58ad commit c557b36
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/misc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,13 @@ class Logger {
if (!fname.empty() && !l.file.is_open())
{
l.file.open(fname, ifstream::out);

if (!l.file.is_open())
{
cerr << "Unable to open debug log file " << fname << endl;
exit(EXIT_FAILURE);
}

cin.rdbuf(&l.in);
cout.rdbuf(&l.out);
}
Expand Down

0 comments on commit c557b36

Please sign in to comment.