direcs  2012-09-30
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
logfile.h
Go to the documentation of this file.
1 /*************************************************************************
2  * Copyright (C) Markus Knapp *
3  * www.direcs.de *
4  * *
5  * This file is part of direcs. *
6  * *
7  * direcs is free software: you can redistribute it and/or modify it *
8  * under the terms of the GNU General Public License as published *
9  * by the Free Software Foundation, version 3 of the License. *
10  * *
11  * direcs is distributed in the hope that it will be useful, *
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14  * GNU General Public License for more details. *
15  * *
16  * You should have received a copy of the GNU General Public License *
17  * along with direcs. If not, see <http://www.gnu.org/licenses/>. *
18  * *
19  *************************************************************************/
20 
21 #ifndef LOGFILE_H
22 #define LOGFILE_H
23 
24 //-------------------------------------------------------------------
25 #include <QObject>
26 #include <QDir>
27 #include <QFile>
28 #include <QTextStream>
29 #include <QDateTime>
30 //-------------------------------------------------------------------
31 
38 class Logfile : public QObject
39 {
40  Q_OBJECT
41 
42  public:
43  Logfile();
44  ~Logfile();
45 
50  void setFilename(QString filename);
51 
52 
53  public slots:
54 
60  void appendLog(QString text, bool CR=true);
61 
68  void writeHeartbeat(unsigned char state);
69 
70 
71  private:
72  QString logFilename;
73  QFile file;
74  QString programPath;
75  QDateTime now;
76 };
77 
78 #endif