3 using System.Runtime.InteropServices;
4 using System.Runtime.CompilerServices;
6 namespace ElmSharp.Test
8 internal static class Log
10 const string Library = "libdlog.so.0";
11 const string TAG = "ElmSharp.Test";
13 public static void Debug(string message,
14 [CallerFilePath] string file = "",
15 [CallerMemberName] string func = "",
16 [CallerLineNumber] int line = 0)
18 Print(LogPriority.DLOG_DEBUG, TAG, message, file, func, line);
21 public static void Info(string message,
22 [CallerFilePath] string file = "",
23 [CallerMemberName] string func = "",
24 [CallerLineNumber] int line = 0)
26 Print(LogPriority.DLOG_DEBUG, TAG, message, file, func, line);
29 public static void Error(string message,
30 [CallerFilePath] string file = "",
31 [CallerMemberName] string func = "",
32 [CallerLineNumber] int line = 0)
34 Print(LogPriority.DLOG_DEBUG, TAG, message, file, func, line);
37 internal enum LogPriority
51 private static void Print(LogPriority priority, string tag, string message, string file, string func, int line)
53 FileInfo finfo = new FileInfo(file);
54 Print(priority, tag, "%s: %s(%d) > %s", finfo.Name, func, line, message);
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);