[NUI] Listen text changed event so that can notify binded instance when Text is chang...
[platform/core/csapi/tizenfx.git] / test / ElmSharp.Test / Log.cs
1 using System;
2 using System.IO;
3 using System.Runtime.InteropServices;
4 using System.Runtime.CompilerServices;
5
6 namespace ElmSharp.Test
7 {
8     internal static class Log
9     {
10         const string Library = "libdlog.so.0";
11         const string TAG = "ElmSharp.Test";
12
13         public static void Debug(string message,
14                 [CallerFilePath] string file = "",
15                 [CallerMemberName] string func = "",
16                 [CallerLineNumber] int line = 0)
17         {
18             Print(LogPriority.DLOG_DEBUG, TAG, message, file, func, line);
19         }
20
21         public static void Info(string message,
22                 [CallerFilePath] string file = "",
23                 [CallerMemberName] string func = "",
24                 [CallerLineNumber] int line = 0)
25         {
26             Print(LogPriority.DLOG_DEBUG, TAG, message, file, func, line);
27         }
28
29         public static void Error(string message,
30                 [CallerFilePath] string file = "",
31                 [CallerMemberName] string func = "",
32                 [CallerLineNumber] int line = 0)
33         {
34             Print(LogPriority.DLOG_DEBUG, TAG, message, file, func, line);
35         }
36
37         internal enum LogPriority
38         {
39             DLOG_UNKNOWN = 0,
40             DLOG_DEFAULT,
41             DLOG_VERBOSE,
42             DLOG_DEBUG,
43             DLOG_INFO,
44             DLOG_WARN,
45             DLOG_ERROR,
46             DLOG_FATAL,
47             DLOG_SILENT,
48             DLOG_PRIO_MAX,
49         }
50
51         private static void Print(LogPriority priority, string tag, string message, string file, string func, int line)
52         {
53             FileInfo finfo = new FileInfo(file);
54             Print(priority, tag, "%s: %s(%d) > %s", finfo.Name, func, line, message);
55         }
56
57         [DllImportAttribute(Library, EntryPoint = "dlog_print")]
58         internal static extern int Print(LogPriority prio, string tag, string fmt, string file, string func, int line, string msg);
59     }
60 }