| 45 | // some special observers |
| 46 | |
| 47 | ConsoleObserverFile::ConsoleObserverFile(const char* sFileName) |
| 48 | : cFileStream(Base::FileInfo(sFileName)) // can be in UTF8 |
| 49 | { |
| 50 | if (!cFileStream.is_open()) { |
| 51 | Console().warning("Cannot open log file '%s'.\n", sFileName); |
| 52 | } |
| 53 | // mark the file as a UTF-8 encoded file |
| 54 | unsigned char bom[3] = {0xef, 0xbb, 0xbf}; |
| 55 | cFileStream.write(reinterpret_cast<const char*>(bom), 3 * sizeof(char)); |
| 56 | } |
| 57 | |
| 58 | ConsoleObserverFile::~ConsoleObserverFile() |
| 59 | { |