12 #include <QTimerEvent> 43 if (QDir::isRelativePath(
fileName) &&
settings->format()!=QSettings::NativeFormat)
48 QFileInfo configFile(
settings->fileName());
49 fileName = QFileInfo(configFile.absolutePath(),
fileName).absoluteFilePath();
62 fprintf(stderr,
"FileLogger::refreshQtSettings: Logging to %s\n", qPrintable(
fileName));
77 if (QDir::isRelativePath(
fileName)) {
91 fprintf(stderr,
"FileLogger::refreshQtSettings: Logging to new file %s\n", qPrintable(
fileName));
100 Q_ASSERT(settings != 0);
101 Q_ASSERT(refreshInterval >= 0);
106 if (refreshInterval > 0) {
118 Q_ASSERT(refreshInterval >= 0);
123 if (refreshInterval > 0) {
147 if (logMessage->
getType() >= QtCriticalMsg) {
155 fprintf(stderr,
"FileLogger::write: Cannot write to log file %s: %s\n", qPrintable(
fileName), qPrintable(
file->errorString()));
170 fprintf(stderr,
"FileLogger::open: Name of logFile is empty\n");
176 if (!
file->open(QIODevice::WriteOnly | QIODevice::Append | QIODevice::Text))
178 fprintf(stderr,
"FileLogger::open: Cannot open log file %s: %s\n", qPrintable(
fileName), qPrintable(
file->errorString()));
183 fprintf(stderr,
"FileLogger::open: Opened log file %s\n", qPrintable(
fileName));
200 fprintf(stderr,
"FileLogger::rotate\n");
208 if (bakFile.exists()) {
223 for (
int i = count;
i > 0; --
i)
236 }
else if (event->timerId() ==
refreshTimer.timerId()) {
void refreshFileLogSettings()
virtual void write(const LogMessage *logMessage)
QtMsgType getType() const
FileLogger(QSettings *settings, const int refreshInterval=10000, QObject *parent=0)
Fixed< IntType, IntBits > arg(const std::complex< Fixed< IntType, IntBits > > &val)
virtual void write(const LogMessage *logMessage)
QString toString(const QString &msgFormat, const QString ×tampFormat) const
FileLoggerSettings fileLoggerSettings
void timerEvent(QTimerEvent *event)