casacore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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: aips2-request@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 //#
27 //# $Id$
28 
29 #ifndef CASA_LOGFILTERINTERFACE_H
30 #define CASA_LOGFILTERINTERFACE_H
31 
32 //# Includes
33 #include <casacore/casa/aips.h>
35 
36 
37 namespace casacore { //# NAMESPACE CASACORE - BEGIN
38 
39 // <summary>
40 // Abstract base class for filtering LogMessages.
41 // </summary>
42 
43 // <use visibility=local>
44 
45 // <reviewed reviewer="wbrouw" date="1996/08/21" tests="" demos="dLogging.cc" tests="tLogging.cc">
46 // </reviewed>
47 
48 // <prerequisite>
49 // <li> <linkto class="LogMessage">LogMessage</linkto>
50 // </prerequisite>
51 //
52 // <etymology>
53 // Log[Message] Filter.
54 // </etymology>
55 //
56 // <synopsis>
57 // The <src>LogFilter</src> class is used by the various log sink classes,
58 // typically accessed through <linkto class="LogSink">LogSink</linkto>, to
59 // decide whether a particular <linkto class="LogMessage">LogMessage</linkto>
60 // should be accepted or rejected.
61 //
62 // Simple filtering is based on the messages priority.
63 // In particular, you typically will choose to only pass messages greater
64 // than or equal to <src>NORMAL</src> in priority, but you might choose
65 // <src>DEBUGGING</src> to see all messages, or <src>SEVERE</src> to only see
66 // messages that report serious problems.
67 // </synopsis>
68 //
69 // <example>
70 // Suppose we wanted to change the global sink so that it prints all messages,
71 // including debugging messages:
72 // <srcblock>
73 // LogFilter all(LogMessage::DEBUGGING);
74 // LogSink::globalSink().filter(all);
75 // </srcblock>
76 // </example>
77 //
78 // <motivation>
79 // </motivation>
80 //
81 //# <todo asof="1996/07/23">
82 //# </todo>
83 
85 {
86 public:
87  // Construct a filter with the LOWEST priority that you want passed. Thus
88  // <src>DEBUGGING</src> passes everything. Note that it is not possible to
89  // block <src>SEVERE</src> level messages, although you can use a
90  // <linkto class="NullLogSink">NullLogSink</linkto> which will have
91  // this effect.
93  {}
94 
95  virtual ~LogFilterInterface();
96 
97  // Clone the object.
98  virtual LogFilterInterface* clone() const = 0;
99 
100  // Return True if <src>message</src> passes this filter.
101  virtual Bool pass (const LogMessage& message) const = 0;
102 
103 private:
104  // Copy constructor and assignment cannot be used.
105  // <group>
106  LogFilterInterface (const LogFilterInterface& other);
108  // </group>
109 };
110 
111 
112 
113 } //# NAMESPACE CASACORE - END
114 
115 #endif
Abstract base class for filtering LogMessages.
LogFilterInterface & operator=(const LogFilterInterface &other)
virtual LogFilterInterface * clone() const =0
Clone the object.
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
virtual Bool pass(const LogMessage &message) const =0
Return True if message passes this filter.
LogFilterInterface()
Construct a filter with the LOWEST priority that you want passed.
Informational log messages with with time, priority, and origin.
Definition: LogMessage.h:101