Beispiel #1
0
        private static bool _InitLogger()
        {
            #if DEBUG
            m_Logger = LPLogger.CreateLogger(ELogType.File, m_sLogDir, m_sProgramName, ELogMode.DayDivide,
                                             (int)(EOutputType.File | EOutputType.Debug | EOutputType.Console), null, (int)(ELogLevel.All), false);
            #else
            m_Logger = LPLogger.CreateLogger(ELogType.File, m_sLogDir, m_sProgramName, ELogMode.DayDivide,
                                             (int)(EOutputType.File | EOutputType.Console), null, (int)(ELogLevel.All), false);
            #endif

            if (LPError.PTF_ERROR(m_Logger != null))
            {
                goto Exit0;
            }

            #if DEBUG
            LP.Logger.IMP("{0}", "debug mode...");
            #else
            LP.Logger.IMP("{0}", "release mode...");
            #endif

            return(true);

Exit0:
            return(false);
        }
Beispiel #2
0
        public static bool UnInit()
        {
            if (m_Logger != null)
            {
                LPError.PTF_ERROR(m_Logger.UnInit());
                m_Logger = null;
            }

            if (m_NetModule != null)
            {
                LPError.PTF_ERROR(m_NetModule.UnInit());
                m_NetModule = null;
            }

            return(true);
        }
Beispiel #3
0
        public static LPLogger CreateLogger(ELogType eLogType, string sDir, string sFileName,
                                            ELogMode eLogMode, int nOutputMask, string sPrefix, int nLogLevel, bool bUseLock)
        {
            bool     bResult = false;
            LPLogger lg      = null;

            switch (eLogType)
            {
            case ELogType.File:
            {
                lg = new LPFileLogger();
                if (PTF_ERROR(lg != null))
                {
                    goto Exit0;
                }

                bResult = lg.Init(sDir, sFileName, eLogMode, nOutputMask, sPrefix, nLogLevel, bUseLock);
                if (PTF_ERROR(bResult))
                {
                    goto Exit0;
                }
            }
            break;

            case ELogType.Invalid:
            case ELogType.Net:
            case ELogType.Total:
            default:
                if (PTF_ERROR(false))
                {
                    goto Exit0;
                }
                break;
            }

            return(lg);

Exit0:

            if (lg != null)
            {
                PTF_ERROR(lg.UnInit());
                lg = null;
            }
            return(null);
        }