From: WonYoung Choi Date: Fri, 29 Jul 2016 08:04:33 +0000 (+0900) Subject: Use "file://" prefix to make a uri X-Git-Tag: submit/trunk/20170823.075128~77^2~19 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=bc627c04c2e29f1fd73cbe9df6ea79fca413bb06;p=platform%2Fcore%2Fcsapi%2Ftizenfx.git Use "file://" prefix to make a uri Change-Id: I9b3c875c24c99adb94fa6f09c562c6f01e57cddb --- diff --git a/src/Tizen/Tizen/Log.cs b/src/Tizen/Tizen/Log.cs old mode 100755 new mode 100644 index 7ade430..7d457c3 --- a/src/Tizen/Tizen/Log.cs +++ b/src/Tizen/Tizen/Log.cs @@ -27,15 +27,7 @@ namespace Tizen /// The line number of calling position. This argument will be set automatically by the compiler. public static void Debug(string tag, string message, [CallerFilePath] string file = "", [CallerMemberName] string func = "", [CallerLineNumber] int line = 0) { - if (String.IsNullOrEmpty(file)) - { - Interop.Dlog.Print(Interop.Dlog.LogPriority.DLOG_DEBUG, tag, "%s", message); - } - else - { - Uri f = new Uri(file); - Interop.Dlog.Print(Interop.Dlog.LogPriority.DLOG_DEBUG, tag, "%s: %s(%d) > %s", Path.GetFileName(f.AbsolutePath), func, line, message); - } + Print(Interop.Dlog.LogPriority.DLOG_DEBUG, tag, message, file, func, line); } /// @@ -48,15 +40,7 @@ namespace Tizen /// The line number of calling position. This argument will be set automatically by the compiler. public static void Verbose(string tag, string message, [CallerFilePath] string file = "", [CallerMemberName] string func = "", [CallerLineNumber] int line = 0) { - if (String.IsNullOrEmpty(file)) - { - Interop.Dlog.Print(Interop.Dlog.LogPriority.DLOG_VERBOSE, tag, "%s", message); - } - else - { - Uri f = new Uri(file); - Interop.Dlog.Print(Interop.Dlog.LogPriority.DLOG_VERBOSE, tag, "%s: %s(%d) > %s", Path.GetFileName(f.AbsolutePath), func, line, message); - } + Print(Interop.Dlog.LogPriority.DLOG_VERBOSE, tag, message, file, func, line); } /// @@ -69,15 +53,7 @@ namespace Tizen /// The line number of calling position. This argument will be set automatically by the compiler. public static void Info(string tag, string message, [CallerFilePath] string file = "", [CallerMemberName] string func = "", [CallerLineNumber] int line = 0) { - if (String.IsNullOrEmpty(file)) - { - Interop.Dlog.Print(Interop.Dlog.LogPriority.DLOG_INFO, tag, "%s", message); - } - else - { - Uri f = new Uri(file); - Interop.Dlog.Print(Interop.Dlog.LogPriority.DLOG_INFO, tag, "%s: %s(%d) > %s", Path.GetFileName(f.AbsolutePath), func, line, message); - } + Print(Interop.Dlog.LogPriority.DLOG_INFO, tag, message, file, func, line); } /// @@ -90,15 +66,7 @@ namespace Tizen /// The line number of calling position. This argument will be set automatically by the compiler. public static void Warn(string tag, string message, [CallerFilePath] string file = "", [CallerMemberName] string func = "", [CallerLineNumber] int line = 0) { - if (String.IsNullOrEmpty(file)) - { - Interop.Dlog.Print(Interop.Dlog.LogPriority.DLOG_WARN, tag, "%s", message); - } - else - { - Uri f = new Uri(file); - Interop.Dlog.Print(Interop.Dlog.LogPriority.DLOG_WARN, tag, "%s: %s(%d) > %s", Path.GetFileName(f.AbsolutePath), func, line, message); - } + Print(Interop.Dlog.LogPriority.DLOG_WARN, tag, message, file, func, line); } /// @@ -111,15 +79,7 @@ namespace Tizen /// The line number of calling position. This argument will be set automatically by the compiler. public static void Error(string tag, string message, [CallerFilePath] string file = "", [CallerMemberName] string func = "", [CallerLineNumber] int line = 0) { - if (String.IsNullOrEmpty(file)) - { - Interop.Dlog.Print(Interop.Dlog.LogPriority.DLOG_ERROR, tag, "%s", message); - } - else - { - Uri f = new Uri(file); - Interop.Dlog.Print(Interop.Dlog.LogPriority.DLOG_ERROR, tag, "%s: %s(%d) > %s", Path.GetFileName(f.AbsolutePath), func, line, message); - } + Print(Interop.Dlog.LogPriority.DLOG_ERROR, tag, message, file, func, line); } /// @@ -132,14 +92,19 @@ namespace Tizen /// The line number of calling position. This argument will be set automatically by the compiler. public static void Fatal(string tag, string message, [CallerFilePath] string file = "", [CallerMemberName] string func = "", [CallerLineNumber] int line = 0) { + Print(Interop.Dlog.LogPriority.DLOG_FATAL, tag, message, file, func, line); + } + + private static void Print(Interop.Dlog.LogPriority priority, string tag, string message, string file, string func, int line) + { if (String.IsNullOrEmpty(file)) { - Interop.Dlog.Print(Interop.Dlog.LogPriority.DLOG_FATAL, tag, "%s", message); + Interop.Dlog.Print(priority, tag, "%s", message); } else { - Uri f = new Uri(file); - Interop.Dlog.Print(Interop.Dlog.LogPriority.DLOG_FATAL, tag, "%s: %s(%d) > %s", Path.GetFileName(f.AbsolutePath), func, line, message); + Uri f = new Uri("file://" + file); + Interop.Dlog.Print(priority, tag, "%s: %s(%d) > %s", Path.GetFileName(f.AbsolutePath), func, line, message); } } }