Vidalia 0.3.1
LogFile.h
Go to the documentation of this file.
1/*
2** This file is part of Vidalia, and is subject to the license terms in the
3** LICENSE file, found in the top level directory of this distribution. If you
4** did not receive the LICENSE file with this file, you may obtain it from the
5** Vidalia source package distributed by the Vidalia Project at
6** http://www.torproject.org/projects/vidalia.html. No part of Vidalia,
7** including this file, may be copied, modified, propagated, or distributed
8** except according to the terms described in the LICENSE file.
9*/
10
11/*
12** \file LogFile.h
13** \brief Logs messages from Tor to a file
14*/
15
16#ifndef _LOGFILE_H
17#define _LOGFILE_H
18
19#include <QFile>
20#include <QObject>
21#include <QString>
22#include <QTextStream>
23
24
25class LogFile : QObject
26{
27 Q_OBJECT
28
29public:
30 /** Default constructor. */
31 LogFile();
32 /** Destructor. */
33 ~LogFile();
34
35 /** Opens a log file for writing. */
36 bool open(QString filename, QString *errmsg = 0);
37 /** Closes an open log file. */
38 void close();
39
40 /** Returns true if the logfile is currently open. */
41 bool isOpen();
42 /** Returns the filename of the current log file. */
43 QString filename();
44
45 /** Overloaded ostream operator. */
46 LogFile& operator<<(const QString &s);
47
48private:
49 /** Creates a path to the given log file */
50 bool createPathToFile(QString filename);
51
52 QFile* _file; /**< The log file. */
53 QTextStream _stream; /**< Stream used to write to the log file. */
54};
55
56#endif
57
QString filename()
Definition: LogFile.cpp:101
bool open(QString filename, QString *errmsg=0)
Definition: LogFile.cpp:50
QFile * _file
Definition: LogFile.h:52
~LogFile()
Definition: LogFile.cpp:30
void close()
Definition: LogFile.cpp:84
QTextStream _stream
Definition: LogFile.h:53
bool createPathToFile(QString filename)
Definition: LogFile.cpp:39
LogFile & operator<<(const QString &s)
Definition: LogFile.cpp:108
bool isOpen()
Definition: LogFile.cpp:94
LogFile()
Definition: LogFile.cpp:24