diff tango/tango/util/log/NullAppender.d @ 132:1700239cab2e trunk

[svn r136] MAJOR UNSTABLE UPDATE!!! Initial commit after moving to Tango instead of Phobos. Lots of bugfixes... This build is not suitable for most things.
author lindquist
date Fri, 11 Jan 2008 17:57:40 +0100
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tango/tango/util/log/NullAppender.d	Fri Jan 11 17:57:40 2008 +0100
@@ -0,0 +1,86 @@
+/*******************************************************************************
+
+        copyright:      Copyright (c) 2004 Kris Bell. All rights reserved
+
+        license:        BSD style: $(LICENSE)
+      
+        version:        Initial release: May 2004
+        
+        author:         Kris
+
+*******************************************************************************/
+
+module tango.util.log.NullAppender;
+
+private import tango.util.log.Appender;
+
+/*******************************************************************************
+
+        An appender that does nothing. This is useful for cutting and
+        pasting, and for benchmarking the tango.log environment.
+
+*******************************************************************************/
+
+public class NullAppender : Appender
+{
+        private Mask mask;
+
+        /***********************************************************************
+               
+                Construct a NullAppender
+
+        ***********************************************************************/
+
+        this ()
+        {
+                // Get a unique fingerprint for this class
+                mask = register (getName);
+        }
+
+        /***********************************************************************
+                
+                Create with the given Layout
+
+        ***********************************************************************/
+
+        this (EventLayout layout)
+        {
+                setLayout (layout);
+        }
+
+        /***********************************************************************
+                
+                Return the fingerprint for this class
+
+        ***********************************************************************/
+
+        Mask getMask ()
+        {
+                return mask;
+        }
+
+        /***********************************************************************
+                
+                Return the name of this class
+
+        ***********************************************************************/
+
+        char[] getName ()
+        {
+                return this.classinfo.name;
+        }
+                
+        /***********************************************************************
+                
+                Append an event to the output.
+                 
+        ***********************************************************************/
+
+        void append (Event event)
+        {
+                auto layout = getLayout;
+                layout.header  (event);
+                layout.content (event);
+                layout.footer  (event);
+        }
+}