log.cpp 370 B

1234567891011121314151617181920212223
  1. #include "log.h"
  2. #include <iostream>
  3. bool
  4. LogUnit::openLog(const char * filename)
  5. {
  6. if (logFile.is_open()) {
  7. cerr << APPNAME
  8. << ": opening a new Log file, while another is already open"
  9. << endl;
  10. logFile.close();
  11. }
  12. logFile.open(filename, ios_base::app);
  13. return !(logFile.fail());
  14. }
  15. void
  16. LogUnit::closeLog()
  17. {
  18. if (logFile.is_open())
  19. logFile.close();
  20. }