From e926e2cd5489ad952df19e5f51cf8ec1aa4ca2c2 Mon Sep 17 00:00:00 2001 From: Kimura Youichi Date: Fri, 10 May 2013 06:55:17 +0900 Subject: [PATCH] =?utf8?q?=E3=82=A8=E3=83=A9=E3=83=BC=E3=83=AD=E3=82=B0?= =?utf8?q?=E3=81=AE=E5=87=BA=E5=8A=9B=E5=85=88=E3=82=92=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit OpenTween.exe が配置されているディレクトリに新たに ErrorLogs ディレクトリが作成 され、その中にエラーログのファイルが生成されるようになります。 --- OpenTween.Tests/MyCommonTest.cs | 11 +++++++++++ OpenTween/MyCommon.cs | 17 +++++++++++++++++ OpenTween/Resources/ChangeLog.txt | 1 + 3 files changed, 29 insertions(+) diff --git a/OpenTween.Tests/MyCommonTest.cs b/OpenTween.Tests/MyCommonTest.cs index e83aa278..6dc66e1b 100644 --- a/OpenTween.Tests/MyCommonTest.cs +++ b/OpenTween.Tests/MyCommonTest.cs @@ -30,6 +30,7 @@ using System.Runtime.InteropServices; using System.Reflection; using System.Windows.Forms; using System.Runtime.Serialization; +using System.IO; namespace OpenTween { @@ -207,5 +208,15 @@ namespace OpenTween { Assert.That(MyCommon.GetStatusUrl(screenName, statusId), Is.EqualTo(except)); } + + [Test] + public void GetErrorLogPathTest() + { + var mockAssembly = Substitute.For<_Assembly>(); + mockAssembly.Location.Returns(@"C:\hogehoge\OpenTween\OpenTween.exe"); + MyCommon.EntryAssembly = mockAssembly; + + Assert.That(MyCommon.GetErrorLogPath(), Is.SamePath(@"C:\hogehoge\OpenTween\ErrorLogs\")); + } } } diff --git a/OpenTween/MyCommon.cs b/OpenTween/MyCommon.cs index 1241b4a1..fc7185ad 100644 --- a/OpenTween/MyCommon.cs +++ b/OpenTween/MyCommon.cs @@ -219,6 +219,11 @@ namespace OpenTween Block | Unblock | UserUpdate | Deleted | ListCreated | ListUpdated | Unfollow), } + public static string GetErrorLogPath() + { + return Path.Combine(Path.GetDirectoryName(MyCommon.EntryAssembly.Location), "ErrorLogs"); + } + public static void TraceOut(Exception ex, string Message) { var buf = ExceptionOutMessage(ex); @@ -235,8 +240,14 @@ namespace OpenTween lock (LockObj) { if (!OutputFlag) return; + + var logPath = MyCommon.GetErrorLogPath(); + if (!Directory.Exists(logPath)) + Directory.CreateDirectory(logPath); + var now = DateTime.Now; var fileName = string.Format("{0}Trace-{1:0000}{2:00}{3:00}-{4:00}{5:00}{6:00}.log", GetAssemblyName(), now.Year, now.Month, now.Day, now.Hour, now.Minute, now.Second); + fileName = Path.Combine(logPath, fileName); using (var writer = new StreamWriter(fileName)) { @@ -344,8 +355,14 @@ namespace OpenTween lock (LockObj) { var IsTerminatePermission = true; + + var logPath = MyCommon.GetErrorLogPath(); + if (!Directory.Exists(logPath)) + Directory.CreateDirectory(logPath); + var now = DateTime.Now; var fileName = string.Format("{0}-{1:0000}{2:00}{3:00}-{4:00}{5:00}{6:00}.log", GetAssemblyName(), now.Year, now.Month, now.Day, now.Hour, now.Minute, now.Second); + fileName = Path.Combine(logPath, fileName); using (var writer = new StreamWriter(fileName)) { diff --git a/OpenTween/Resources/ChangeLog.txt b/OpenTween/Resources/ChangeLog.txt index 04748f69..898d4f00 100644 --- a/OpenTween/Resources/ChangeLog.txt +++ b/OpenTween/Resources/ChangeLog.txt @@ -4,6 +4,7 @@ * NEW: タブの表示位置を画面上部に変更可能に (thx @aokomoriuta!) * NEW: mobile.twitter.com/<スクリーン名>/status/<ステータスID> のURLも関連発言表示の対象に追加 * NEW: Favstarなどサードパーティ製サービスのパーマリンクURLも関連発言表示の対象に追加 + * CHG: エラーログの出力先を変更 (OpenTween.exe と同じ場所に ErrorLogs フォルダが作成されます) * FIX: スペースが含まれているURLをブラウザで開こうとするとURLが分断されて複数のタブが開いてしまう問題を修正 (thx @5px!) * FIX: 画面更新時にInvalidOperationExceptionのエラーが発生する不具合を修正 * FIX: 関連発言表示が非公開アカウントのツイートに対して機能しない問題を修正 -- 2.11.0