From bc627c04c2e29f1fd73cbe9df6ea79fca413bb06 Mon Sep 17 00:00:00 2001 From: WonYoung Choi Date: Fri, 29 Jul 2016 17:04:33 +0900 Subject: [PATCH] Use "file://" prefix to make a uri Change-Id: I9b3c875c24c99adb94fa6f09c562c6f01e57cddb --- src/Tizen/Tizen/Log.cs | 61 +++++++++++--------------------------------------- 1 file changed, 13 insertions(+), 48 deletions(-) mode change 100755 => 100644 src/Tizen/Tizen/Log.cs 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); } } } -- 2.7.4