casacore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
NullLogSink.h
Go to the documentation of this file.
1 //# NullLogSink.h: Throw away all messages.
2 //# Copyright (C) 1996,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_NULLLOGSINK_H
30 #define CASA_NULLLOGSINK_H
31 
32 #include <casacore/casa/aips.h>
34 
35 namespace casacore { //# NAMESPACE CASACORE - BEGIN
36 
37 // <summary>
38 // Throw away all messages.
39 // </summary>
40 
41 // <use visibility=local>
42 
43 // <reviewed reviewer="wbrouw" date="1996/08/21" tests="tLogging.cc" demos="dLogging.cc">
44 // </reviewed>
45 
46 // <prerequisite>
47 // <li> <linkto class=LogSinkInterface>LogSinkInterface</linkto>
48 // </prerequisite>
49 //
50 // <etymology>
51 // Null as in "empty" or "/dev/null".
52 // </etymology>
53 //
54 // <synopsis>
55 // <src>NullLogSink</src> is a trivial
56 // <linkto class=LogSinkInterface>LogSinkInterface</linkto> which merely throws
57 // away all its messages. It is not intended to be used directly, rather it
58 // should be used through <linkto class=LogSink>LogSink</linkto>.
59 // </synopsis>
60 //
61 // <example>
62 // See <linkto file="Logging.h">Logging.h</linkto>.
63 // </example>
64 //
65 // <motivation>
66 // For testing, or to prevent multiply logging (local and global) to
67 // <src>cerr</src> (say).
68 // </motivation>
69 //
70 // <todo asof="1996/07/24">
71 // <li> Nothing known.
72 // </todo>
73 
74 class NullLogSink : public LogSinkInterface {
75 public:
76  NullLogSink();
78  explicit NullLogSink(const LogFilterInterface &filter);
79 
80  NullLogSink(const NullLogSink &other);
81  NullLogSink &operator=(const NullLogSink &other);
82 
83  ~NullLogSink();
84 
85  // Always throws the message away, but it does return <src>True</src> or
86  // <src>False</src> depending on whether or not <src>message</src> passes
87  // the filter.
88  virtual Bool postLocally(const LogMessage &message);
89 
90  // Returns the id for this class...
91  static String localId( );
92  // Returns the id of the LogSink in use...
93  String id( ) const;
94 };
95 
96 
97 } //# NAMESPACE CASACORE - END
98 
99 #endif
100 
101 
Abstract base class for filtering LogMessages.
Throw away all messages.
Definition: NullLogSink.h:74
Accepts LogMessages and posts them to some destination.
NullLogSink & operator=(const NullLogSink &other)
String id() const
Returns the id of the LogSink in use...
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
virtual const LogFilterInterface & filter() const
Get/set the filter.
Priority
An &quot;importance&quot; which is assigned to each LogMessage.
Definition: LogMessage.h:105
String: the storage and methods of handling collections of characters.
Definition: String.h:225
virtual Bool postLocally(const LogMessage &message)
Always throws the message away, but it does return True or False depending on whether or not message ...
Informational log messages with with time, priority, and origin.
Definition: LogMessage.h:101
static String localId()
Returns the id for this class...