Exemplo n.º 1
0
        private static void UseAuditProvider()
        {
            SamplePolicy   policy     = new SamplePolicy();
            SampleProvider provider   = new SampleProvider(policy);
            Guid           instanceId = Guid.NewGuid();

            Boolean isCanceled = false;

            Console.CancelKeyPress += (object sender, ConsoleCancelEventArgs e) => { isCanceled = true; e.Cancel = true; };

            provider.AuditApplicationInitialization(instanceId);
            while (!isCanceled)
            {
                provider.AuditAuthenticationSuccess("log entry");
                Console.WriteLine("Logged new entry. Press CTRL+C to stop ...");
                Thread.Sleep(1000);
            }
            provider.AuditApplicationTermination(instanceId);
        }
Exemplo n.º 2
0
 public SampleProvider(SamplePolicy policy)
     : base(policy, Program.EventLogName, LogLocation.SecurityLog)
 {
 }