예제 #1
0
        static void RedirectOutputToFileWindows()
        {
            writer = CreateLogFile("Ide");
            if (writer == Console.Out)
            {
                return;
            }

            stderr = new MonoDevelop.Core.ProgressMonitoring.LogTextWriter();
            stderr.ChainWriter(Console.Error);
            stderr.ChainWriter(writer);
            defaultError = Console.Error;
            Console.SetError(stderr);

            stdout = new MonoDevelop.Core.ProgressMonitoring.LogTextWriter();
            stdout.ChainWriter(Console.Out);
            stdout.ChainWriter(writer);
            defaultOut = Console.Out;
            Console.SetOut(stdout);
        }
예제 #2
0
        static void RedirectOutputToFileWindows(FilePath logDirectory, string logName)
        {
            var stream = File.Open(logDirectory.Combine(logName), FileMode.Create, FileAccess.Write, FileShare.Read);
            var writer = new StreamWriter(stream)
            {
                AutoFlush = true
            };

            var stderr = new MonoDevelop.Core.ProgressMonitoring.LogTextWriter();

            stderr.ChainWriter(Console.Error);
            stderr.ChainWriter(writer);
            defaultError = Console.Error;
            Console.SetError(stderr);

            var stdout = new MonoDevelop.Core.ProgressMonitoring.LogTextWriter();

            stdout.ChainWriter(Console.Out);
            stdout.ChainWriter(writer);
            defaultOut = Console.Out;
            Console.SetOut(stdout);
        }
		static void RedirectOutputToFileWindows (FilePath logDirectory, string logName)
		{
			var stream = File.Open (logDirectory.Combine (logName), FileMode.Create, FileAccess.Write, FileShare.Read);
			var writer = new StreamWriter (stream) { AutoFlush = true };
			
			var stderr = new MonoDevelop.Core.ProgressMonitoring.LogTextWriter ();
			stderr.ChainWriter (Console.Error);
			stderr.ChainWriter (writer);
			defaultError = Console.Error;
			Console.SetError (stderr);

			var stdout = new MonoDevelop.Core.ProgressMonitoring.LogTextWriter ();
			stdout.ChainWriter (Console.Out);
			stdout.ChainWriter (writer);
			defaultOut = Console.Out;
			Console.SetOut (stdout);
		}
예제 #4
0
		static void EnableFileLogging ( )
		{
			if (Path.DirectorySeparatorChar != '\\')
				return;

			// On Windows log all output to a log file

			FilePath logDir = UserProfile.Current.LogDir;
			if (!Directory.Exists (logDir))
				Directory.CreateDirectory (logDir);

			string file = logDir.Combine ("log.txt");
			try {
				logFile = new StreamWriter (file);
				logFile.AutoFlush = true;

				var tw = new MonoDevelop.Core.ProgressMonitoring.LogTextWriter ();
				tw.ChainWriter (logFile);
				tw.ChainWriter (Console.Out);
				Console.SetOut (tw);

				tw = new MonoDevelop.Core.ProgressMonitoring.LogTextWriter ();
				tw.ChainWriter (logFile);
				tw.ChainWriter (Console.Error);
				Console.SetError (tw);
			}
			catch {
			}
		}
예제 #5
0
		static void RedirectOutputToFileWindows ()
		{
			writer = CreateLogFile ("Ide");
			if (writer == Console.Out)
				return;

			stderr = new MonoDevelop.Core.ProgressMonitoring.LogTextWriter ();
			stderr.ChainWriter (Console.Error);
			stderr.ChainWriter (writer);
			defaultError = Console.Error;
			Console.SetError (stderr);

			stdout = new MonoDevelop.Core.ProgressMonitoring.LogTextWriter ();
			stdout.ChainWriter (Console.Out);
			stdout.ChainWriter (writer);
			defaultOut = Console.Out;
			Console.SetOut (stdout);
		}