Herunterladen als
root/src/logger.h @ bf16a581
38838b5b | Christian Ehringfeld | /*
|
|
* Copyright (C) 2015 Christian Ehringfeld <c.ehringfeld@t-online.de>
|
|||
*
|
|||
* This program is free software; you can redistribute it and/or modify it
|
|||
* under the terms of the GNU Lesser General Public License as published by
|
|||
* the Free Software Foundation.
|
|||
*
|
|||
* This program is distributed in the hope that it will be useful, but
|
|||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
|||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|||
* for more details.
|
|||
*
|
|||
* You should have received a copy of the GNU Lesser General Public License
|
|||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
|||
*/
|
|||
100034b7 | Christian Ehringfeld | #ifndef LOGGER_H
|
|
#define LOGGER_H
|
|||
#include <QString>
|
|||
#include <QFile>
|
|||
#include <QSqlError>
|
|||
#include <QSqlQuery>
|
|||
2b455197 | Christian Ehringfeld | namespace CuteEntityManager {
|
|
66704054 | Christian Ehringfeld | class Logger {
|
|
public:
|
|||
Logger(QString path = "");
|
|||
45135a14 | Christian Ehringfeld | ~Logger();
|
|
100034b7 | Christian Ehringfeld | QString defaultPath() const;
|
|
void lastError(const QSqlError &e);
|
|||
66704054 | Christian Ehringfeld | void lastError(const QSqlQuery &q, bool logQuery = false);
|
|
100034b7 | Christian Ehringfeld | QString getPath();
|
|
void setPath(const QString &value);
|
|||
e332a521 | Christian Ehringfeld | void logMsg(const QString &value);
|
|
100034b7 | Christian Ehringfeld | ||
66704054 | Christian Ehringfeld | protected:
|
|
100034b7 | Christian Ehringfeld | QString generateLogMsg(const QSqlError &e) const;
|
|
66704054 | Christian Ehringfeld | QString generateLogMsg(const QSqlQuery &q, bool withValues = true) const;
|
|
100034b7 | Christian Ehringfeld | ||
66704054 | Christian Ehringfeld | private:
|
|
100034b7 | Christian Ehringfeld | QString path;
|
|
};
|
|||
2b455197 | Christian Ehringfeld | }
|
|
100034b7 | Christian Ehringfeld | #endif // LOGGER_H
|