Ejemplo n.º 1
0
        public static void LogTestStart(TestContext testContext)
        {
            // save and restore the p4config env variable and the cwd
            SaveP4Prefs();
            allocs = P4Debugging.GetStringAllocs();
            frees  = P4Debugging.GetStringReleases();

            cwd = System.IO.Directory.GetCurrentDirectory();

            logDelegate     = new P4CallBacks.LogMessageDelegate(LogFunction);
            logFileDelegate = new LogFile.LogMessageDelgate(LogFileFunction);

            LogFile.SetLoggingFunction(logFileDelegate);

            P4Debugging.SetBridgeLogFunction(logDelegate);
            preTestObjectCount = new int[P4Debugging.GetAllocObjectCount()];

            for (int i = 0; i < preTestObjectCount.Length; i++)
            {
                preTestObjectCount[i] = P4Debugging.GetAllocObject(i);
            }

            // reset the p4d_cmd variable to the default
            p4d_cmd = _p4d_cmd;

            testCount++;
            logger.Info("====== TestName: {0}", testContext.TestName);
            stopWatch = Stopwatch.StartNew();
            if (stopWatchAllTests == null)
            {
                stopWatchAllTests = Stopwatch.StartNew();
            }
        }
Ejemplo n.º 2
0
 public static void stopDebugLogging(string action)
 {
     logDelegate = null;
     P4Debugging.SetBridgeLogFunction(logDelegate);
     if (diagnosticLogging())
     {
         LogMessage(4, action, Properties.Resources.FileLogger_EndDiagLogging);
     }
 }
Ejemplo n.º 3
0
 private static void LogFunction(int log_level, string file, int line, string message)
 {
     if (!diagnosticLogging())
     {
         logDelegate = null;
         return;
     }
     LogMessage(log_level, file + " (" + line + ") ", message);
 }
Ejemplo n.º 4
0
        public static void startDebugLogging(string action)
        {
            if (diagnosticLogging())
            {
                LogMessage(4, action, Properties.Resources.FileLogger_BeginDiagLogging);
                logDelegate = new P4CallBacks.LogMessageDelegate(LogFunction);

                P4Debugging.SetBridgeLogFunction(logDelegate);
                debugObjectCount = new int[P4Debugging.GetAllocObjectCount()];

                for (int i = 0; i < debugObjectCount.Length; i++)
                {
                    debugObjectCount[i] = P4Debugging.GetAllocObject(i);
                }
            }
        }