Esempio n. 1
0
 /// <summary>
 /// Register Windows EventLog source.
 /// <para>You can call this at anytime, does nothing if source is already registered.</para>
 /// </summary>
 public void RegisterSource()
 {
     try
     {
         // If source does not exists.
         if (!EventLog.SourceExists(this.Source))
         {
             EventLog.CreateEventSource(this.Source, this.Source);
             JKLogger.SuccessAudit("Windows Event source \"" + this.Source + "\" is created. Restart the application to allow it to be registered.", typeof(WindowsEvent), "JKLog");
             return;
         }
     }
     catch (Exception)
     {
         JKLogger.FailureAudit("Failed to create Windows Event source. Call RegisterSource() while running as Administrator.", typeof(WindowsEvent), "JKLog");
     }
 }
Esempio n. 2
0
        public static void UseTests()
        {
            // simple
            JKLogger.Error("This is Error");
            JKLogger.Warning("This is Warning");
            JKLogger.Information("This is Information");
            JKLogger.SuccessAudit("This is SuccessAudit");
            JKLogger.FailureAudit("This is FailureAudit");
            JKLogger.Debug("This is Debug");


            User testContext = new User("StaticTestName", 99);

            // more advanced
            JKLogger.Error("This is Error", testContext, "TestCategory");
            JKLogger.Warning("This is Warning", testContext, "TestCategory");
            JKLogger.Information("This is Information", testContext, "TestCategory");
            JKLogger.SuccessAudit("This is SuccessAudit", testContext, "TestCategory");
            JKLogger.FailureAudit("This is FailureAudit", testContext, "TestCategory");
            JKLogger.Debug("This is Debug", testContext, "TestCategory");
        }