casacore
Loading...
Searching...
No Matches
LogFilter.h
Go to the documentation of this file.
1//# LogFilter.h: Filter LogMessages on message priority
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_LOGFILTER_H
27#define CASA_LOGFILTER_H
28
29//# Includes
30#include <casacore/casa/aips.h>
31#include <casacore/casa/Logging/LogFilterInterface.h>
32
33
34namespace casacore { //# NAMESPACE CASACORE - BEGIN
35
36// <summary>
37// Filter LogMessages on message priority.
38// </summary>
39
40// <use visibility=export>
41
42// <reviewed reviewer="wbrouw" date="1996/08/21" tests="" demos="dLogging.cc" tests="tLogging.cc">
43// </reviewed>
44
45// <prerequisite>
46// <li> <linkto class="LogMessage">LogMessage</linkto>
47// </prerequisite>
48//
49// <etymology>
50// Log[Message] Filter.
51// </etymology>
52//
53// <synopsis>
54// The <src>LogFilter</src> class is used by the various log sink classes,
55// typically accessed through <linkto class="LogSink">LogSink</linkto>, to
56// decide whether a particular <linkto class="LogMessage">LogMessage</linkto>
57// should be accepted or rejected.
58//
59// Simple filtering is based on the messages priority.
60// In particular, you typically will choose to only pass messages greater
61// than or equal to <src>NORMAL</src> in priority, but you might choose
62// <src>DEBUGGING</src> to see all messages, or <src>SEVERE</src> to only see
63// messages that report serious problems.
64// </synopsis>
65//
66// <example>
67// Suppose we wanted to change the global sink so that it prints all messages,
68// including debugging messages:
69// <srcblock>
70// LogFilter all(LogMessage::DEBUGGING);
71// LogSink::globalSink().filter(all);
72// </srcblock>
73// </example>
74//
75// <motivation>
76// </motivation>
77//
78//# <todo asof="1996/07/23">
79//# </todo>
80
82{
83public:
84 // Construct a filter with the LOWEST priority that you want passed. Thus
85 // <src>DEBUGGING</src> passes everything. Note that it is not possible to
86 // block <src>SEVERE</src> level messages, although you can use a
87 // <linkto class="NullLogSink">NullLogSink</linkto> which will have
88 // this effect.
90
91 // Copy <src>other</src> to <src>this</src>.
92 // <group>
93 LogFilter (const LogFilter& other);
95 // </group>
96
97 virtual ~LogFilter();
98
99 // Clone the object.
100 virtual LogFilter* clone() const;
101
102 // Return True if <src>message</src> passes this filter.
103 virtual Bool pass (const LogMessage& message) const;
104
105 // Return the lowest priority which will pass this filter.
107
108private:
110};
111
112
114{
115 return lowest_p;
116}
117
118
119
120} //# NAMESPACE CASACORE - END
121
122#endif
LogFilter(const LogFilter &other)
Copy other to this.
LogMessage::Priority lowest_p
Definition LogFilter.h:109
LogFilter & operator=(const LogFilter &other)
virtual LogFilter * clone() const
Clone the object.
LogMessage::Priority lowestPriority() const
Return the lowest priority which will pass this filter.
Definition LogFilter.h:113
virtual Bool pass(const LogMessage &message) const
Return True if message passes this filter.
LogFilter(LogMessage::Priority lowest=LogMessage::NORMAL)
Construct a filter with the LOWEST priority that you want passed.
Priority
An "importance" which is assigned to each LogMessage.
Definition LogMessage.h:102
this file contains all the compiler specific defines
Definition mainpage.dox:28
bool Bool
Define the standard types used by Casacore.
Definition aipstype.h:40