I was debugging an Lx200 server, using Stellarium as a client, and it was very puzzling to have an empty log_TelescopeServer1.txt all the way until I finally closed Stellarium.
It appears that the log system is based on QFile that's opened with QFile::Unbuffered, on top of which a QTextStream is layered, and this one is always buffered. Previously the log output was done with endl at the end, which, according to the docs, writes \r\n on Windows and \n on other platforms (provided the file is opened with QFile::Text, which it is), after which it flushes the stream. But since e8d67bc these endl were replaced by a kludge of StelUtils::getEndLineChar(), which of course only writes the line ending but doesn't flush.
Now, what problem was this replacement meant to solve? The endl should've been doing its job well enough, no?
I was debugging an Lx200 server, using Stellarium as a client, and it was very puzzling to have an empty
log_TelescopeServer1.txtall the way until I finally closed Stellarium.It appears that the log system is based on
QFilethat's opened withQFile::Unbuffered, on top of which aQTextStreamis layered, and this one is always buffered. Previously the log output was done withendlat the end, which, according to the docs, writes\r\non Windows and\non other platforms (provided the file is opened withQFile::Text, which it is), after which it flushes the stream. But since e8d67bc theseendlwere replaced by a kludge ofStelUtils::getEndLineChar(), which of course only writes the line ending but doesn't flush.Now, what problem was this replacement meant to solve? The
endlshould've been doing its job well enough, no?