Beispiel #1
0
        /// <summary>
        /// The singleton can get set in two ways:
        ///
        /// 1.) The developer promotes their class to be the Logger object inside the singleton
        /// 2.) We decide for them what their class is going to look like
        /// </summary>
        /// <returns></returns>
        public static VSLogger singleton()
        {
            if (logger == null)
            {
                lock (syncRoot)
                {
                    if (logger == null)
                    {
                        //use defaults
                        string logFile = DateTime.Now.ToShortDateString().Replace(@"/", @"-").Replace(@"\", @"-") + ".log";
                        logger          = new VSLogger(6, logFile);
                        logLevelDesc    = new string[6];
                        logLevelDesc[0] = "EVENT";
                        logLevelDesc[1] = "COM_MES";
                        logLevelDesc[2] = "COM_FIS";
                        logLevelDesc[3] = "COM_RFID";
                        logLevelDesc[4] = "SEQUENCE";
                        logLevelDesc[5] = "ERROR";
                    }
                }
            }

            return(logger);
        }
Beispiel #2
0
 /// <summary>
 /// Takes the current object and places it as the internal singleton reference
 /// </summary>
 /// <returns></returns>
 public VSLogger promoteToStatic()
 {
     logger = this;
     return(logger);
 }