From: cskim Date: Tue, 28 Mar 2017 05:47:01 +0000 (+0900) Subject: Fix to debuggingutil to display caller information X-Git-Tag: submit/tizen/20170808.015446~152 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5571d6060fb820c893fdb4c024e55ed083c60771;p=profile%2Ftv%2Fapps%2Fdotnet%2Fhome.git Fix to debuggingutil to display caller information Change-Id: Ifc24bcd7579fdf0b94b3ae05d066e57072294f2f --- diff --git a/LibTVRefCommonPortable/Utils/DebuggingUtils.cs b/LibTVRefCommonPortable/Utils/DebuggingUtils.cs index 8ee0563..85c2528 100644 --- a/LibTVRefCommonPortable/Utils/DebuggingUtils.cs +++ b/LibTVRefCommonPortable/Utils/DebuggingUtils.cs @@ -14,6 +14,8 @@ * limitations under the License. */ +using System; +using System.Runtime.CompilerServices; using Xamarin.Forms; namespace LibTVRefCommonPortable.Utils @@ -38,11 +40,11 @@ namespace LibTVRefCommonPortable.Utils /// This is required for the unit testing of the Calculator application. private class DefaultSM : IDebuggingAPIs { - public void Dbg(string message) + public void Dbg(string message, String file, String func, Int32 line) { } - public void Err(string message) + public void Err(string message, String file, String func, Int32 line) { } @@ -68,17 +70,17 @@ namespace LibTVRefCommonPortable.Utils /// /// A method displays a debugging message /// A list of command line arguments. - public static void Dbg(string message) + public static void Dbg(string message, [CallerFilePath] System.String file = "", [CallerMemberName] System.String func = "", [CallerLineNumber] System.Int32 line = 0) { - ism.Dbg(message); + ism.Dbg(message, file, func, line); } /// /// A method displays a error message /// A list of command line arguments. - public static void Err(string message) + public static void Err(string message, [CallerFilePath] System.String file = "", [CallerMemberName] System.String func = "", [CallerLineNumber] System.Int32 line = 0) { - ism.Err(message); + ism.Err(message, file, func, line); } /// diff --git a/LibTVRefCommonPortable/Utils/IDebuggingAPIs.cs b/LibTVRefCommonPortable/Utils/IDebuggingAPIs.cs index 0b8c138..4c6fc04 100644 --- a/LibTVRefCommonPortable/Utils/IDebuggingAPIs.cs +++ b/LibTVRefCommonPortable/Utils/IDebuggingAPIs.cs @@ -14,6 +14,8 @@ * limitations under the License. */ +using System; + namespace LibTVRefCommonPortable.Utils { /// @@ -35,11 +37,11 @@ namespace LibTVRefCommonPortable.Utils /// /// A method displays a error log. /// A error message. - void Dbg(string message); + void Dbg(string message, String file, String func, Int32 line); /// /// A method displays a dialog with a given message. /// A debugging message. - void Err(string message); + void Err(string message, String file, String func, Int32 line); } } diff --git a/LibTVRefCommonTizen/Ports/DbgPort.cs b/LibTVRefCommonTizen/Ports/DbgPort.cs index b647b2a..24a10f5 100644 --- a/LibTVRefCommonTizen/Ports/DbgPort.cs +++ b/LibTVRefCommonTizen/Ports/DbgPort.cs @@ -17,6 +17,8 @@ using Xamarin.Forms.Platform.Tizen.Native; using Tizen; using LibTVRefCommonPortable.Utils; +using System.Runtime.CompilerServices; +using System; namespace LibTVRefCommonTizen.Ports { @@ -51,17 +53,17 @@ namespace LibTVRefCommonTizen.Ports /// /// A method displays a debugging log. /// A debugging message. - public void Dbg(string message) + public void Dbg(string message, String file, String func, Int32 line) { - D(message); + D(message, file, func, line); } /// /// A method displays a error log. /// A error message. - public void Err(string message) + public void Err(string message, String file, String func, Int32 line) { - E(message); + E(message, file, func, line); } /// @@ -85,15 +87,15 @@ namespace LibTVRefCommonTizen.Ports toast.Show(); } - public static void D(string message) + public static void D(string message, [CallerFilePath] System.String file = "", [CallerMemberName] System.String func = "", [CallerLineNumber] System.Int32 line = 0) { - Log.Debug(TAG, Prefix + ", " + message); + Log.Debug(TAG, Prefix + ", " + message, file, func, line); } - public static void E(string message) + public static void E(string message, [CallerFilePath] System.String file = "", [CallerMemberName] System.String func = "", [CallerLineNumber] System.Int32 line = 0) { - Log.Error(TAG, Prefix + ", " + message); + Log.Error(TAG, Prefix + ", " + message, file, func, line); } }