summaryrefslogtreecommitdiff
path: root/src/loggers.h
blob: 1497cc198318f4d55557e666dfd2b91399896e64 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
/** \file loggers.h    -*-c++-*- */

//   Copyright (C) 2009 Daniel Burrows
//
//   This program is free software; you can redistribute it and/or
//   modify it under the terms of the GNU General Public License as
//   published by the Free Software Foundation; either version 2 of
//   the License, or (at your option) any later version.
//
//   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 General Public License
//   along with this program; see the file COPYING.  If not, write to
//   the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
//   Boston, MA 02111-1307, USA.


#ifndef LOGGERS_H
#define LOGGERS_H

#include <log4cxx/logger.h>

// Safe logging macros -- unlike the log4cxx macros, these expand to
// statements needing a semicolon, so you can write them like function
// calls with no surprises.  They also save a few keystrokes.
#define LOG_TRACE(logger, args) do { LOG4CXX_TRACE(logger, args); } while(0)
#define LOG_DEBUG(logger, args) do { LOG4CXX_DEBUG(logger, args); } while(0)
#define LOG_INFO(logger, args) do { LOG4CXX_INFO(logger, args); } while(0)
#define LOG_WARN(logger, args) do { LOG4CXX_WARN(logger, args); } while(0)
#define LOG_ERROR(logger, args) do { LOG4CXX_ERROR(logger, args); } while(0)
#define LOG_FATAL(logger, args) do { LOG4CXX_FATAL(logger, args); } while(0)

namespace aptitude
{
  /** \brief A global repository for the loggers used in aptitude.
   *  The sole purpose of this file is to keep that information in one
   *  place.
   *
   *  It would be nicer if we could enforce that somehow, but that's
   *  not compatible with the design of log4cxx.
   */
  class Loggers
  {
    // Could define static variables here, but that would have no real purpose.
  public:
    /** \brief The logger for events having to do with aptitude's
     *  global apt state.
     *
     *  Name: aptitude.apt.globals
     */
    static log4cxx::LoggerPtr getAptitudeAptGlobals();

    /** \brief The logger for events having to do with aptitude's
     *  wrapper around the apt cache.
     *
     *  Name: aptitude.apt.cache
     */
    static log4cxx::LoggerPtr getAptitudeAptCache();

    /** \brief The logger for events having to do with aptitude's
     *  backend changelog download code.
     */
    static log4cxx::LoggerPtr getAptitudeChangelog();

    /** \brief The logger for events having to do with aptitude's
     *  caching of downloaded data (other than package lists and
     *  .debs).
     */
    static log4cxx::LoggerPtr getAptitudeDownloadCache();

    /** \brief The logger for events having to do with the dpkg
     *  status pipe.
     */
    static log4cxx::LoggerPtr getAptitudeDpkgStatusPipe();

    /** \brief The logger for events having to do with the dpkg
     *  terminal in the GTK+ frontend.
     */
    static log4cxx::LoggerPtr getAptitudeDpkgTerminal();

    /** \brief The logger for events having to do with the dpkg
     *  terminal and subprocess activity/inactivity in the GTK+
     *  frontend.
     */
    static log4cxx::LoggerPtr getAptitudeDpkgTerminalInactivity();

    /** \brief The logger for the GUI dashboard tab's upgrade
     *         resolver.
     *
     *  Name: aptitude.gtk.dashboard.upgrade.resolver
     */
    static log4cxx::LoggerPtr getAptitudeGtkDashboardUpgradeResolver();

    /** \brief The logger for GUI changelog handling.
     *
     *  Name: aptitude.gtk.changelog
     */
    static log4cxx::LoggerPtr getAptitudeGtkChangelog();

    /** \brief The logger for the GUI changelog cache thread.
     *
     *  Name: aptitude.gtk.changelog.cache
     */
    static log4cxx::LoggerPtr getAptitudeGtkChangelogCache();

    /** \brief The logger for the GUI changelog parse thread.
     *
     *  Name: aptitude.gtk.changelog.parse
     */
    static log4cxx::LoggerPtr getAptitudeGtkChangelogParse();

    /** \brief The logger for the GUI package view (PkgView).
     *
     *  Name: aptitude.gtk.pkgview
     */
    static log4cxx::LoggerPtr getAptitudeGtkPkgView();

    /** \brief The logger for the GUI resolver tab.
     *
     *  Name: aptitude.gtk.resolver
     */
    static log4cxx::LoggerPtr getAptitudeGtkResolver();

    /** \brief The logger for events related to GUI tabs.
     *
     *  Name: aptitude.gtk.tabs
     */
    static log4cxx::LoggerPtr getAptitudeGtkTabs();

    /** \brief The logger for the dependency resolver.
     *
     *  Name: aptitude.resolver
     */
    static log4cxx::LoggerPtr getAptitudeResolver();


    /** \brief The logger for resolver hints.
     *
     *  Name: aptitude.resolver.hints
     */
    static log4cxx::LoggerPtr getAptitudeResolverHints();

    /** \brief The logger for comparing resolver hints.
     *
     *  Name: aptitude.resolver.hints.compare
     */
    static log4cxx::LoggerPtr getAptitudeResolverHintsCompare();

    /** \brief The logger for matching resolver hints against
     * packages.
     *
     *  Name: aptitude.resolver.hints.match
     */
    static log4cxx::LoggerPtr getAptitudeResolverHintsMatch();

    /** \brief The logger for parsing resolver hints.
     *
     *  Name: aptitude.resolver.hints.parse
     */
    static log4cxx::LoggerPtr getAptitudeResolverHintsParse();

    /** \brief The logger for describing which packages are initially
     *  considered "manual".
     *
     *  Name: aptitude.resolver.initialManualFlags
     */
    static log4cxx::LoggerPtr getAptitudeResolverInitialManualFlags();

    /** \brief The logger for the "upgrade/install only" logic in the
     *  dependency resolver.
     *
     *  Name: aptitude.resolver.safeResolver
     */
    static log4cxx::LoggerPtr getAptitudeResolverSafeResolver();

    /** \brief The logger for the setup routine for the safe resolver
     * logic.
     *
     *  Name: aptitude.resolver.safeResolver.setup
     */
    static log4cxx::LoggerPtr getAptitudeResolverSafeResolverSetup();

    /** \brief The logger for setting up scores for the dependency
     *  resolver.
     *
     *  Name: aptitude.resolver.scores
     */
    static log4cxx::LoggerPtr getAptitudeResolverScores();

    /** \brief The logger for the resolver's search logic.
     *
     *  Name: aptitude.resolver.search
     */
    static log4cxx::LoggerPtr getAptitudeResolverSearch();

    /** \brief The logger for the resolver's search-graph maintenance.
     */
    static log4cxx::LoggerPtr getAptitudeResolverSearchGraph();

    /** \brief The logger for the tiering component of the resolver's
     *  search logic.
     *
     *  Name: aptitude.resolver.search.tiers
     */
    static log4cxx::LoggerPtr getAptitudeResolverSearchTiers();

    /** \brief The logger for events related to setting up and running
     *  the background resolver thread.
     */
    static log4cxx::LoggerPtr getAptitudeResolverThread();

    /** \brief The logger for setting up tiers for the dependency
     *  resolver.
     *
     *  Name: aptitude.resolver.tiers
     */
    static log4cxx::LoggerPtr getAptitudeResolverTiers();

    /** \brief The logger for the "why" command.
     *
     *  Name: aptitude.why
     */
    static log4cxx::LoggerPtr getAptitudeWhy();

    /** \brief The logger for the GTK+ interface to the "why" command.
     *
     *  Name: aptitude.why
     */
    static log4cxx::LoggerPtr getAptitudeWhyGtk();
  };
}

#endif // LOGGERS_H