diff options
author | Michael Hutchinson <m.j.hutchinson@gmail.com> | 2011-08-24 22:20:39 +0400 |
---|---|---|
committer | Michael Hutchinson <m.j.hutchinson@gmail.com> | 2011-08-24 23:05:47 +0400 |
commit | ee3523493159604f65ad5f5a9c3ff310f2b28f4e (patch) | |
tree | f9ff99805e3d2227065439e70826d71657bc72d4 /main/src | |
parent | ad391d4263ae61a907e08190a5b7fd45b1e3d512 (diff) |
[MacDev] Write Xcode4 log to file instead of stdout
Diffstat (limited to 'main/src')
-rw-r--r-- | main/src/addins/MonoDevelop.MacDev/XcodeSyncing/XcodeProjectTracker.cs | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/main/src/addins/MonoDevelop.MacDev/XcodeSyncing/XcodeProjectTracker.cs b/main/src/addins/MonoDevelop.MacDev/XcodeSyncing/XcodeProjectTracker.cs index 2aa2de0873..1de8362a59 100644 --- a/main/src/addins/MonoDevelop.MacDev/XcodeSyncing/XcodeProjectTracker.cs +++ b/main/src/addins/MonoDevelop.MacDev/XcodeSyncing/XcodeProjectTracker.cs @@ -394,32 +394,32 @@ namespace MonoDevelop.MacDev.XcodeSyncing static class XC4Debug { - static bool? enabled; + static TextWriter writer; - public static bool Enabled { - get { - if (!enabled.HasValue) { - var s = Environment.GetEnvironmentVariable ("MD_DEBUG_XCODE_SYNC"); - enabled = "true".Equals (s, StringComparison.OrdinalIgnoreCase); - } - return enabled.Value; + static XC4Debug () + { + FilePath logDir = UserProfile.Current.LogDir; + FilePath logFile = logDir.Combine ("Xcode4Sync.log"); + FileService.EnsureDirectoryExists (logDir); + try { + writer = new StreamWriter (logFile) { AutoFlush = true }; + } catch (Exception ex) { + LoggingService.LogError ("Could not create Xcode sync logging file", ex); } } public static void Log (string message) { - if (!Enabled) + if (writer == null) return; - Console.Write ("XC4: "); - Console.WriteLine (message); + writer.WriteLine (message); } public static void Log (string messageFormat, params object[] values) { - if (!Enabled) + if (writer == null) return; - Console.Write ("XC4: "); - Console.WriteLine (messageFormat, values); + writer.WriteLine (messageFormat, values); } } }
\ No newline at end of file |