Mercurial > projects > ldc
comparison 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 |
comparison
equal
deleted
inserted
replaced
131:5825d48b27d1 | 132:1700239cab2e |
---|---|
1 /******************************************************************************* | |
2 | |
3 copyright: Copyright (c) 2004 Kris Bell. All rights reserved | |
4 | |
5 license: BSD style: $(LICENSE) | |
6 | |
7 version: Initial release: May 2004 | |
8 | |
9 author: Kris | |
10 | |
11 *******************************************************************************/ | |
12 | |
13 module tango.util.log.NullAppender; | |
14 | |
15 private import tango.util.log.Appender; | |
16 | |
17 /******************************************************************************* | |
18 | |
19 An appender that does nothing. This is useful for cutting and | |
20 pasting, and for benchmarking the tango.log environment. | |
21 | |
22 *******************************************************************************/ | |
23 | |
24 public class NullAppender : Appender | |
25 { | |
26 private Mask mask; | |
27 | |
28 /*********************************************************************** | |
29 | |
30 Construct a NullAppender | |
31 | |
32 ***********************************************************************/ | |
33 | |
34 this () | |
35 { | |
36 // Get a unique fingerprint for this class | |
37 mask = register (getName); | |
38 } | |
39 | |
40 /*********************************************************************** | |
41 | |
42 Create with the given Layout | |
43 | |
44 ***********************************************************************/ | |
45 | |
46 this (EventLayout layout) | |
47 { | |
48 setLayout (layout); | |
49 } | |
50 | |
51 /*********************************************************************** | |
52 | |
53 Return the fingerprint for this class | |
54 | |
55 ***********************************************************************/ | |
56 | |
57 Mask getMask () | |
58 { | |
59 return mask; | |
60 } | |
61 | |
62 /*********************************************************************** | |
63 | |
64 Return the name of this class | |
65 | |
66 ***********************************************************************/ | |
67 | |
68 char[] getName () | |
69 { | |
70 return this.classinfo.name; | |
71 } | |
72 | |
73 /*********************************************************************** | |
74 | |
75 Append an event to the output. | |
76 | |
77 ***********************************************************************/ | |
78 | |
79 void append (Event event) | |
80 { | |
81 auto layout = getLayout; | |
82 layout.header (event); | |
83 layout.content (event); | |
84 layout.footer (event); | |
85 } | |
86 } |