Example #1
0
 /// <summary>
 /// Will return instance, or instantiate if instance is null. Will trigger
 /// the first log entry if file name has been set since program launch and
 /// instantiation was needed.
 /// </summary>
 /// <returns></returns>
 public static VBLogger getLogger()
 {
     if (me == null)
     {
         lock (syncRoot) {
             if (me == null)
             {
                 me = new VBLogger();
                 if (!logFileName.Equals(String.Empty))
                 {
                     me.logFirstTime();
                 }
             }
         }
     }
     return(me);
 }
Example #2
0
        /// <summary>
        /// Destructor makes final log entry to signal normal program termination.
        /// </summary>
        //       ~VBLogger() {
        //if (!logFileName.Equals(String.Empty)) {
        //    logClose();
        //}
        //        }

        public static void logClose()
        {
            if (me != null)
            {
                lock (syncRoot) {
                    if (me != null)
                    {
                        me.logEvent("Log closed normally.");
                        if (me.MessageEventLogged != null)
                        {
                            foreach (Delegate del in me.MessageEventLogged.GetInvocationList())
                            {
                                me.MessageEventLogged -= (MessageLoggedEventHandler)del;
                            }
                        }
                        logFileName = String.Empty;
                        me          = null;
                    }
                }
            }
        }
Example #3
0
 /// <summary>
 /// Will return instance, or instantiate if instance is null. Will trigger
 /// the first log entry if file name has been set since program launch and
 /// instantiation was needed.
 /// </summary>
 /// <returns></returns>
 public static VBLogger getLogger()
 {
     if (me == null) {
         lock (syncRoot) {
             if (me == null) {
                 me = new VBLogger();
                 if (!logFileName.Equals(String.Empty)) {
                     me.logFirstTime();
                 }
             }
         }
     }
     return me;
 }
Example #4
0
 /// <summary>
 /// Destructor makes final log entry to signal normal program termination.
 /// </summary>
 //       ~VBLogger() {
 //if (!logFileName.Equals(String.Empty)) {
 //    logClose();
 //}
 //        }
 public static void logClose()
 {
     if(me != null){
         lock (syncRoot) {
             if (me != null) {
                 me.logEvent("Log closed normally.");
                 if (me.MessageEventLogged != null) {
                     foreach (Delegate del in me.MessageEventLogged.GetInvocationList()) {
                         me.MessageEventLogged -= (MessageLoggedEventHandler)del;
                     }
                 }
                 logFileName = String.Empty;
                 me = null;
             }
         }
     }
 }