12 private StreamWriter file;
14 private readonly
int deleteAfterDays;
59 this.deleteAfterDays = DeleteAfterDays;
61 string FolderName = Path.GetDirectoryName(FileName);
63 if (!Directory.Exists(FolderName))
66 Directory.CreateDirectory(FolderName);
75 if (!this.fileSequence.TryGetNewFileName(out
string s))
90 this.output = this.file = File.CreateText(s);
92 if (this.deleteAfterDays <
int.MaxValue)
94 string FolderName = Path.GetDirectoryName(s);
96 Runtime.IO.Files.DeleteOldFiles(FolderName, TimeSpan.FromDays(
this.deleteAfterDays), SearchOption.AllDirectories,
true);
105 base.DisposeOutput();
107 this.file?.Dispose();
Outputs sniffed data to a text file.
TextFileEventSink(string ObjectID, string FileName)
Outputs sniffed data to a text file.
TextFileEventSink(string ObjectID, string FileName, int DeleteAfterDays)
Outputs sniffed data to a text file.
override void DisposeOutput()
Disposes of the current output.
override void BeforeWrite()
Method is called before writing something to the text file.
Outputs sniffed data to a text writer.
Static class managing the application event log. Applications and services log events on this static ...
static void Informational(string Message, string Object, string Actor, string EventId, EventLevel Level, string Facility, string Module, string StackTrace, params KeyValuePair< string, object >[] Tags)
Logs an informational event.
virtual string ObjectID
Object ID, used when logging events.
Class that generates a sequence of file names, based on the system time.