5 // Atsushi Enomoto <atsushi@ximian.com>
6 // Gert Driesen <drieseng@users.sourceforge.net>
8 // (C) 2006 Novell, Inc.
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:
20 // The above copyright notice and this permission notice shall be
21 // included in all copies or substantial portions of the Software.
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.
33 using System
.Diagnostics
;
35 namespace System
.Diagnostics
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
41 public NullEventLog (EventLog coreEventLog
)
46 public override void BeginInit ()
50 public override void Clear ()
54 public override void Close ()
58 public override void CreateEventSource (EventSourceCreationData sourceData
)
62 public override void Delete (string logName
, string machineName
)
66 public override void DeleteEventSource (string source
, string machineName
)
70 public override void Dispose (bool disposing
)
74 public override void DisableNotification ()
78 public override void EnableNotification ()
82 public override void EndInit ()
86 public override bool Exists (string logName
, string machineName
)
91 protected override string FormatMessage (string source
, uint messageID
, string [] replacementStrings
)
93 return string.Join (", ", replacementStrings
);
96 protected override int GetEntryCount ()
101 protected override EventLogEntry
GetEntry (int index
)
106 protected override string GetLogDisplayName ()
108 return CoreEventLog
.Log
;
111 protected override string [] GetLogNames (string machineName
)
113 return new string [0];
116 public override string LogNameFromSourceName (string source
, string machineName
)
121 public override bool SourceExists (string source
, string machineName
)
126 public override void WriteEntry (string [] replacementStrings
, EventLogEntryType type
, uint instanceID
, short category
, byte [] rawData
)
131 public override OverflowAction OverflowAction
{
132 get { return OverflowAction.DoNotOverwrite; }
135 public override int MinimumRetentionDays
{
136 get { return int.MaxValue; }
139 public override long MaximumKilobytes
{
140 get { return long.MaxValue; }
141 set { throw new NotSupportedException ("This EventLog implementation does not support setting max kilobytes policy"); }
144 public override void ModifyOverflowPolicy (OverflowAction action
, int retentionDays
)
146 throw new NotSupportedException ("This EventLog implementation does not support modifying overflow policy");
149 public override void RegisterDisplayName (string resourceFile
, long resourceId
)
151 throw new NotSupportedException ("This EventLog implementation does not support registering display name");