merged Sys.Web.Services 2.0 support in my branch:
[mono.git] / mcs / class / System / System.Diagnostics / NullEventLog.cs
1 //
2 // NullEventLog.cs
3 //
4 // Author:
5 //   Atsushi Enomoto  <atsushi@ximian.com>
6 //   Gert Driesen  <drieseng@users.sourceforge.net>
7 //
8 // (C) 2006 Novell, Inc.
9 //
10
11 //
12 // Permission is hereby granted, free of charge, to any person obtaining
13 // a copy of this software and associated documentation files (the
14 // "Software"), to deal in the Software without restriction, including
15 // without limitation the rights to use, copy, modify, merge, publish,
16 // distribute, sublicense, and/or sell copies of the Software, and to
17 // permit persons to whom the Software is furnished to do so, subject to
18 // the following conditions:
19 // 
20 // The above copyright notice and this permission notice shall be
21 // included in all copies or substantial portions of the Software.
22 // 
23 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
27 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
28 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
29 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30 //
31
32 using System;
33 using System.Diagnostics;
34
35 namespace System.Diagnostics
36 {
37         // Empty implementation that does not need any specific platform
38         // but should be enough to get applications to run that WRITE to eventlog
39         internal class NullEventLog : EventLogImpl
40         {
41                 public NullEventLog (EventLog coreEventLog)
42                         : base (coreEventLog)
43                 {
44                 }
45
46                 public override void BeginInit ()
47                 {
48                 }
49
50                 public override void Clear ()
51                 {
52                 }
53
54                 public override void Close ()
55                 {
56                 }
57
58                 public override void CreateEventSource (EventSourceCreationData sourceData)
59                 {
60                 }
61
62                 public override void Delete (string logName, string machineName)
63                 {
64                 }
65
66                 public override void DeleteEventSource (string source, string machineName)
67                 {
68                 }
69
70                 public override void Dispose (bool disposing)
71                 {
72                 }
73
74                 public override void EndInit ()
75                 {
76                 }
77
78                 public override bool Exists (string logName, string machineName)
79                 {
80                         return true;
81                 }
82
83                 protected override string FormatMessage (string source, uint messageID, string [] replacementStrings)
84                 {
85                         return string.Join (", ", replacementStrings);
86                 }
87
88                 protected override int GetEntryCount ()
89                 {
90                         return 0;
91                 }
92
93                 protected override EventLogEntry GetEntry (int index)
94                 {
95                         return null;
96                 }
97
98                 protected override string GetLogDisplayName ()
99                 {
100                         return CoreEventLog.Log;
101                 }
102
103                 protected override string [] GetLogNames (string machineName)
104                 {
105                         return new string [0];
106                 }
107
108                 public override string LogNameFromSourceName (string source, string machineName)
109                 {
110                         return null;
111                 }
112
113                 public override bool SourceExists (string source, string machineName)
114                 {
115                         return false;
116                 }
117
118                 public override void WriteEntry (string [] replacementStrings, EventLogEntryType type, uint instanceID, short category, byte [] rawData)
119                 {
120                 }
121         }
122 }