[Tizen.Log] Optimize getting filename
authorYoungjae Cho <y0.cho@samsung.com>
Fri, 22 Jul 2022 04:38:27 +0000 (13:38 +0900)
committerhyotaekshim <35134695+hyotaekshim@users.noreply.github.com>
Fri, 22 Jul 2022 06:06:23 +0000 (15:06 +0900)
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
src/Tizen.Log/Tizen/Log.cs

index 3bb3854..927513a 100755 (executable)
@@ -15,8 +15,6 @@
  */
 
 using System;
-using System.IO;
-using System.Linq;
 using System.Runtime.CompilerServices;
 using System.ComponentModel;
 
@@ -121,8 +119,8 @@ namespace Tizen
             }
             else
             {
-                string[] fileslice = file.Split(new char[] { '\\', '/' });
-                string filename = fileslice.Last();
+                int index = file.LastIndexOfAny(new char[] { '\\', '/' });
+                string filename = file.Substring(index + 1);
                 Interop.Dlog.Print(priority, tag, "%s: %s(%d) > %s", filename, func, line, message);
             }
         }
@@ -228,8 +226,8 @@ namespace Tizen
             }
             else
             {
-                string[] fileslice = file.Split(new char[] { '\\', '/' });
-                string filename = fileslice.Last();
+                int index = file.LastIndexOfAny(new char[] { '\\', '/' });
+                string filename = file.Substring(index + 1);
                 Interop.Dlog.InternalPrint(log_id, priority, tag, "%s: %s(%d) > %s", filename, func, line, message);
             }
         }
@@ -336,8 +334,8 @@ namespace Tizen
             }
             else
             {
-                string[] fileslice = file.Split(new char[] { '\\', '/' });
-                string filename = fileslice.Last();
+                int index = file.LastIndexOfAny(new char[] { '\\', '/' });
+                string filename = file.Substring(index + 1);
                 Interop.Dlog.InternalPrint(log_id, priority, tag, "%s: %s(%d) > %s", filename, func, line, message);
             }
 #endif