namespace Tizen.Runtime
{
-#if CLOG
- internal static class Log
+ internal static class ALog
{
- static void Print(string tag, string message)
- {
- string[] lines = message.Split('\r');
- foreach (string line in lines)
- {
- Console.WriteLine($"{tag} : {message}");
- }
- }
-
- public static void Debug(string tag, string message)
- {
- Print($"D/{tag}", message);
- }
-
- public static void Info(string tag, string message)
- {
- Print($"I/{tag}", message);
- }
+ const string Library = "libdlog.so.0";
+ const string Tag = "DOTNET_LAUNCHER";
- public static void Error(string tag, string message)
+ internal enum LogPriority
{
- Print($"E/{tag}", message);
+ DLOG_UNKNOWN = 0,
+ DLOG_DEFAULT,
+ DLOG_VERBOSE,
+ DLOG_DEBUG,
+ DLOG_INFO,
+ DLOG_WARN,
+ DLOG_ERROR,
+ DLOG_FATAL,
+ DLOG_SILENT,
+ DLOG_PRIO_MAX,
}
- }
-#endif
- internal static class ALog
- {
- const string Library = "libdlog.so.0";
- const string TAG = "DOTNET_LAUNCHER";
public static void Debug(string message,
[CallerFilePath] string file = "",
- [CallerMemberName] string func = "",
+ [CallerMemberName] string function = "",
[CallerLineNumber] int line = 0)
{
- Print(LogPriority.DLOG_DEBUG, TAG, message, file, func, line);
+ Print(LogPriority.DLOG_DEBUG, Tag, message, file, function, line);
}
public static void Info(string message,
[CallerFilePath] string file = "",
- [CallerMemberName] string func = "",
+ [CallerMemberName] string function = "",
[CallerLineNumber] int line = 0)
{
- Print(LogPriority.DLOG_DEBUG, TAG, message, file, func, line);
+ Print(LogPriority.DLOG_INFO, Tag, message, file, function, line);
}
public static void Error(string message,
[CallerFilePath] string file = "",
- [CallerMemberName] string func = "",
+ [CallerMemberName] string function = "",
[CallerLineNumber] int line = 0)
{
- Print(LogPriority.DLOG_DEBUG, TAG, message, file, func, line);
+ Print(LogPriority.DLOG_ERROR, Tag, message, file, function, line);
}
- internal enum LogPriority
- {
- DLOG_UNKNOWN = 0,
- DLOG_DEFAULT,
- DLOG_VERBOSE,
- DLOG_DEBUG,
- DLOG_INFO,
- DLOG_WARN,
- DLOG_ERROR,
- DLOG_FATAL,
- DLOG_SILENT,
- DLOG_PRIO_MAX,
- }
+ [DllImportAttribute(Library, EntryPoint = "dlog_print")]
+ internal static extern int Print(LogPriority priority, string tag, string format, string file, string function, int line, string msg);
- private static void Print(LogPriority priority, string tag, string message, string file, string func, int line)
+ private static void Print(LogPriority priority, string tag, string message, string file, string function, int line)
{
- FileInfo finfo = new FileInfo(file);
- Print(priority, tag, "%s: %s(%d) > %s", finfo.Name, func, line, message);
+ FileInfo fileInfo = new FileInfo(file);
+ Print(priority, tag, "%s: %s(%d) > %s", fileInfo.Name, function, line, message);
}
- [DllImportAttribute(Library, EntryPoint = "dlog_print")]
- internal static extern int Print(LogPriority prio, string tag, string fmt, string file, string func, int line, string msg);
}
}