[NUI] Rebase develnui (DevelNUI only patches --> master) (#3910)
[platform/core/csapi/tizenfx.git] / test / Tizen.NUI.Devel.Tests.Ubuntu / nunit.framework / TUnit / TLogger.cs
1 // ****************************************************************************************************
2 // Namespace:       NUnit.Framework.TUnit
3 // Class:           TLogger
4 // Description:     Tizen UnitTest Logger
5 // Author:          Nguyen Truong Duong <duong.nt1@samsung.com>
6 // Notes:          
7 // Revision History:
8 // Name:           Date:        Description:
9 // ****************************************************************************************************
10 #define PORTABLE
11 #define TIZEN
12 #define NUNIT_FRAMEWORK
13 #define NUNITLITE
14 #define NET_4_5
15 #define PARALLEL
16 using System;
17 using System.Collections.Generic;
18 using System.Linq;
19 using System.Text;
20 using System.Threading.Tasks;
21
22 namespace NUnit.Framework.TUnit
23 {
24     public class TLogger
25     {
26         public static string DefaultTag = "TUnit";
27         public static string TUnitTag = "TUnit";
28         public static string ExceptionTag = "TException";
29
30         public static void Write(string logTag, string message)
31         {
32             Tizen.Log.Info(TUnitTag, message);
33             Console.WriteLine(logTag + message);
34         }
35
36         public static void Write(string message)
37         {
38             Write(DefaultTag, message);
39         }
40
41         public static void WriteError(string message)
42         {
43             Tizen.Log.Error(TUnitTag, message);
44         }
45         public static void WriteError(string tag, string message)
46         {
47             Tizen.Log.Error(tag, message);
48         }
49     }
50
51     public class LogUtils
52     {
53         static public string DEBUG = "D";
54         static public string INFO = "I";
55         static public string ERROR = "E";
56         static public string TAG = "TUnit";
57
58         static public void Write(string level, string tag, string msg)
59         {
60             foreach (string line in msg.Split('\n'))
61             {
62                 Console.WriteLine(tag + "[" + level + "] | " + line);
63                 WriteDlog(level, tag, line);
64            }
65         }
66
67         static private void WriteDlog(string level, string tag, string msg)
68         {
69             if (level.Equals(DEBUG))
70             {
71                 Tizen.Log.Debug(tag, msg);
72             }
73             else if (level.Equals(INFO))
74             {
75                 Tizen.Log.Info(tag, msg);
76             }
77             else if (level.Equals(ERROR))
78             {
79                 Tizen.Log.Error(tag, msg);
80             }
81             else
82             {
83                 Tizen.Log.Info(tag, msg);
84             }
85         }
86     }
87 }