casacore
Loading...
Searching...
No Matches
LogFilterInterface.h
Go to the documentation of this file.
1// # LogFilterInterface.h: Abstract base class for filtering LogMessages
2// # Copyright (C) 1996,2000,2003
3// # Associated Universities, Inc. Washington DC, USA.
4// #
5// # This library is free software; you can redistribute it and/or modify it
6// # under the terms of the GNU Library General Public License as published by
7// # the Free Software Foundation; either version 2 of the License, or (at your
8// # option) any later version.
9// #
10// # This library is distributed in the hope that it will be useful, but WITHOUT
11// # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12// # FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
13// # License for more details.
14// #
15// # You should have received a copy of the GNU Library General Public License
16// # along with this library; if not, write to the Free Software Foundation,
17// # Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
18// #
19// # Correspondence concerning AIPS++ should be addressed as follows:
20// # Internet email: casa-feedback@nrao.edu.
21// # Postal address: AIPS++ Project Office
22// # National Radio Astronomy Observatory
23// # 520 Edgemont Road
24// # Charlottesville, VA 22903-2475 USA
25
26#ifndef CASA_LOGFILTERINTERFACE_H
27#define CASA_LOGFILTERINTERFACE_H
28
29// # Includes
30#include <casacore/casa/aips.h>
31#include <casacore/casa/Logging/LogMessage.h>
32
33namespace casacore { // # NAMESPACE CASACORE - BEGIN
34
35// <summary>
36// Abstract base class for filtering LogMessages.
37// </summary>
38
39// <use visibility=local>
40
41// <reviewed reviewer="wbrouw" date="1996/08/21" tests="" demos="dLogging.cc" tests="tLogging.cc">
42// </reviewed>
43
44// <prerequisite>
45// <li> <linkto class="LogMessage">LogMessage</linkto>
46// </prerequisite>
47//
48// <etymology>
49// Log[Message] Filter.
50// </etymology>
51//
52// <synopsis>
53// The <src>LogFilter</src> class is used by the various log sink classes,
54// typically accessed through <linkto class="LogSink">LogSink</linkto>, to
55// decide whether a particular <linkto class="LogMessage">LogMessage</linkto>
56// should be accepted or rejected.
57//
58// Simple filtering is based on the messages priority.
59// In particular, you typically will choose to only pass messages greater
60// than or equal to <src>NORMAL</src> in priority, but you might choose
61// <src>DEBUGGING</src> to see all messages, or <src>SEVERE</src> to only see
62// messages that report serious problems.
63// </synopsis>
64//
65// <example>
66// Suppose we wanted to change the global sink so that it prints all messages,
67// including debugging messages:
68// <srcblock>
69// LogFilter all(LogMessage::DEBUGGING);
70// LogSink::globalSink().filter(all);
71// </srcblock>
72// </example>
73//
74// <motivation>
75// </motivation>
76//
77// # <todo asof="1996/07/23">
78// # </todo>
79
81 public:
82 // Construct a filter with the LOWEST priority that you want passed. Thus
83 // <src>DEBUGGING</src> passes everything. Note that it is not possible to
84 // block <src>SEVERE</src> level messages, although you can use a
85 // <linkto class="NullLogSink">NullLogSink</linkto> which will have
86 // this effect.
88
90
91 // Clone the object.
92 virtual LogFilterInterface* clone() const = 0;
93
94 // Return True if <src>message</src> passes this filter.
95 virtual Bool pass(const LogMessage& message) const = 0;
96
97 private:
98 // Copy constructor and assignment cannot be used.
99 // <group>
102 // </group>
103};
104
105} // namespace casacore
106
107#endif
LogFilterInterface()
Construct a filter with the LOWEST priority that you want passed.
virtual LogFilterInterface * clone() const =0
Clone the object.
virtual Bool pass(const LogMessage &message) const =0
Return True if message passes this filter.
LogFilterInterface & operator=(const LogFilterInterface &other)
LogFilterInterface(const LogFilterInterface &other)
Copy constructor and assignment cannot be used.
For temporary backward namespace compatibility, use casa as alias for casacore.
Definition mainpage.dox:28
bool Bool
Define the standard types used by Casacore.
Definition aipstype.h:40