casa
$Rev:20696$
|
00001 //# NullLogSink.h: Throw away all messages. 00002 //# Copyright (C) 1996,2003 00003 //# Associated Universities, Inc. Washington DC, USA. 00004 //# 00005 //# This library is free software; you can redistribute it and/or modify it 00006 //# under the terms of the GNU Library General Public License as published by 00007 //# the Free Software Foundation; either version 2 of the License, or (at your 00008 //# option) any later version. 00009 //# 00010 //# This library is distributed in the hope that it will be useful, but WITHOUT 00011 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00012 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public 00013 //# License for more details. 00014 //# 00015 //# You should have received a copy of the GNU Library General Public License 00016 //# along with this library; if not, write to the Free Software Foundation, 00017 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA. 00018 //# 00019 //# Correspondence concerning AIPS++ should be addressed as follows: 00020 //# Internet email: aips2-request@nrao.edu. 00021 //# Postal address: AIPS++ Project Office 00022 //# National Radio Astronomy Observatory 00023 //# 520 Edgemont Road 00024 //# Charlottesville, VA 22903-2475 USA 00025 //# 00026 //# 00027 //# $Id: NullLogSink.h 20551 2009-03-25 00:11:33Z Malte.Marquarding $ 00028 00029 #ifndef CASA_NULLLOGSINK_H 00030 #define CASA_NULLLOGSINK_H 00031 00032 #include <casa/aips.h> 00033 #include <casa/Logging/LogSinkInterface.h> 00034 00035 namespace casa { //# NAMESPACE CASA - BEGIN 00036 00037 // <summary> 00038 // Throw away all messages. 00039 // </summary> 00040 00041 // <use visibility=local> 00042 00043 // <reviewed reviewer="wbrouw" date="1996/08/21" tests="tLogging.cc" demos="dLogging.cc"> 00044 // </reviewed> 00045 00046 // <prerequisite> 00047 // <li> <linkto class=LogSinkInterface>LogSinkInterface</linkto> 00048 // </prerequisite> 00049 // 00050 // <etymology> 00051 // Null as in "empty" or "/dev/null". 00052 // </etymology> 00053 // 00054 // <synopsis> 00055 // <src>NullLogSink</src> is a trivial 00056 // <linkto class=LogSinkInterface>LogSinkInterface</linkto> which merely throws 00057 // away all its messages. It is not intended to be used directly, rather it 00058 // should be used through <linkto class=LogSink>LogSink</linkto>. 00059 // </synopsis> 00060 // 00061 // <example> 00062 // See <linkto file="Logging.h">Logging.h</linkto>. 00063 // </example> 00064 // 00065 // <motivation> 00066 // For testing, or to prevent multiply logging (local and global) to 00067 // <src>cerr</src> (say). 00068 // </motivation> 00069 // 00070 // <todo asof="1996/07/24"> 00071 // <li> Nothing known. 00072 // </todo> 00073 00074 class NullLogSink : public LogSinkInterface { 00075 public: 00076 NullLogSink(); 00077 explicit NullLogSink(LogMessage::Priority filter); 00078 explicit NullLogSink(const LogFilterInterface &filter); 00079 00080 NullLogSink(const NullLogSink &other); 00081 NullLogSink &operator=(const NullLogSink &other); 00082 00083 ~NullLogSink(); 00084 00085 // Always throws the message away, but it does return <src>True</src> or 00086 // <src>False</src> depending on whether or not <src>message</src> passes 00087 // the filter. 00088 virtual Bool postLocally(const LogMessage &message); 00089 00090 // Returns the id for this class... 00091 static String localId( ); 00092 // Returns the id of the LogSink in use... 00093 String id( ) const; 00094 }; 00095 00096 00097 } //# NAMESPACE CASA - END 00098 00099 #endif 00100 00101