Lomiri Download Manager  0.1.2
A session-wide downloading service
logger.h
Go to the documentation of this file.
1 /*
2  * Copyright 2014 Canonical Ltd.
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of version 3 of the GNU Lesser General Public
6  * License as published by the Free Software Foundation.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11  * General Public License for more details.
12  *
13  * You should have received a copy of the GNU Lesser General Public
14  * License along with this library; if not, write to the
15  * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
16  * Boston, MA 02110-1301, USA.
17  */
18 
19 #ifndef LOMIRI_DOWNLOADMANAGER_CLIENT_LOGGER_H
20 #define LOMIRI_DOWNLOADMANAGER_CLIENT_LOGGER_H
21 
22 #include <QMap>
23 #include <QMutex>
24 #include <QString>
25 #include <QStringList>
26 #include <QVariant>
27 
28 
29 namespace Lomiri {
30 
31 namespace DownloadManager {
32 
33 class DownloadImpl;
34 class DownloadPCW;
35 class ManagerImpl;
36 class DownloadManagerPCW;
37 class DownloadsListManagerPCW;
38 class GroupManagerPCW;
39 class MetadataDownloadsListManagerPCW;
40 class DownloadStruct;
41 
42 namespace Logging {
43 
44 class LoggerPrivate;
45 
55 class Logger {
56  friend class Lomiri::DownloadManager::DownloadImpl;
57  friend class Lomiri::DownloadManager::DownloadPCW;
58  friend class Lomiri::DownloadManager::ManagerImpl;
59  friend class Lomiri::DownloadManager::DownloadManagerPCW;
60  friend class Lomiri::DownloadManager::DownloadsListManagerPCW;
61  friend class Lomiri::DownloadManager::GroupManagerPCW;
62  friend class Lomiri::DownloadManager::MetadataDownloadsListManagerPCW;
63 
64  public:
66  enum Level
67  {
74  };
75 
82  static void init(Level lvl, const QString& path);
83 
84  protected:
85 
88  static void log(Level lvl, const QString& msg);
89  static void log(Level lvl, const QStringList& msg);
90  static void log(Level lvl, const QString& msg, QMap<QString, QString> map);
91  static void log(Level lvl, const QString& msg, QMap<QString, QVariant> map);
92  static void log(Level lvl, const QString& msg, DownloadStruct downStruct);
96  private:
97  static QMutex _mutex;
98  static LoggerPrivate* _private;
99 };
100 
101 } // Logging
102 
103 } // DownloadManager
104 
105 } // Lomiri
106 
107 #endif
Lomiri::DownloadManager::Logging::Logger::Level
Level
Definition: logger.h:66
Lomiri::DownloadManager::Logging::Logger::Warning
@ Warning
Definition: logger.h:71
Lomiri
Definition: download.h:26
Lomiri::DownloadManager::Logging::Logger
The Logger class allows to control a logging that is performed within the library allowed the develop...
Definition: logger.h:55
Lomiri::DownloadManager::Logging::Logger::Critical
@ Critical
Definition: logger.h:73
Lomiri::DownloadManager::Logging::Logger::init
static void init(Level lvl, const QString &path)
Definition: logger.cpp:188
Lomiri::DownloadManager::Logging::Logger::Notification
@ Notification
Definition: logger.h:70
Lomiri::DownloadManager::Logging::Logger::Normal
@ Normal
Definition: logger.h:69
Lomiri::DownloadManager::Logging::Logger::Debug
@ Debug
Definition: logger.h:68
Lomiri::DownloadManager::Logging::Logger::Error
@ Error
Definition: logger.h:72