1 /// Copyright 2016 by Samsung Electronics, Inc.,
3 /// This software is the confidential and proprietary information
4 /// of Samsung Electronics, Inc. ("Confidential Information"). You
5 /// shall not disclose such Confidential Information and shall use
6 /// it only in accordance with the terms of the license agreement
7 /// you entered into with Samsung.
12 using System.Runtime.CompilerServices;
17 /// Provides methods to print log messages to Tizen logging system.
22 /// Prints a log message with the DEBUG priority.
24 /// <param name="tag">The tag name of the log message.</param>
25 /// <param name="msg">The log message to print.</param>
26 /// <param name="file">The source file path of the caller function. This argument will be set automatically by the compiler.</param>
27 /// <param name="func">The function name of caller function. This argument will be set automatically by the compiler.</param>
28 /// <param name="line">The line number of calling position. This argument will be set automatically by the compiler.</param>
29 public static void Debug(string tag, string msg, [CallerFilePath] string file = "", [CallerMemberName] string func = "", [CallerLineNumber] int line = 0)
31 if (String.IsNullOrEmpty(file))
33 Interop.Dlog.Print(Interop.Dlog.LogPriority.DLOG_DEBUG, tag, "%s", msg);
37 Uri f = new Uri(file);
38 Interop.Dlog.Print(Interop.Dlog.LogPriority.DLOG_DEBUG, tag, "%s: %s(%d) > %s", Path.GetFileName(f.AbsolutePath), func, line, msg);
43 /// Prints a log message with the VERBOSE priority.
45 /// <param name="tag">The tag name of the log message.</param>
46 /// <param name="msg">The log message to print.</param>
47 /// <param name="file">The source file path of the caller function. This argument will be set automatically by the compiler.</param>
48 /// <param name="func">The function name of caller function. This argument will be set automatically by the compiler.</param>
49 /// <param name="line">The line number of calling position. This argument will be set automatically by the compiler.</param>
50 public static void Verbose(string tag, string msg, [CallerFilePath] string file = "", [CallerMemberName] string func = "", [CallerLineNumber] int line = 0)
52 if (String.IsNullOrEmpty(file))
54 Interop.Dlog.Print(Interop.Dlog.LogPriority.DLOG_VERBOSE, tag, "%s", msg);
58 Uri f = new Uri(file);
59 Interop.Dlog.Print(Interop.Dlog.LogPriority.DLOG_VERBOSE, tag, "%s: %s(%d) > %s", Path.GetFileName(f.AbsolutePath), func, line, msg);
64 /// Prints a log message with the INFO priority.
66 /// <param name="tag">The tag name of the log message.</param>
67 /// <param name="msg">The log message to print.</param>
68 /// <param name="file">The source file path of the caller function. This argument will be set automatically by the compiler.</param>
69 /// <param name="func">The function name of caller function. This argument will be set automatically by the compiler.</param>
70 /// <param name="line">The line number of calling position. This argument will be set automatically by the compiler.</param>
71 public static void Info(string tag, string msg, [CallerFilePath] string file = "", [CallerMemberName] string func = "", [CallerLineNumber] int line = 0)
73 if (String.IsNullOrEmpty(file))
75 Interop.Dlog.Print(Interop.Dlog.LogPriority.DLOG_INFO, tag, "%s", msg);
79 Uri f = new Uri(file);
80 Interop.Dlog.Print(Interop.Dlog.LogPriority.DLOG_INFO, tag, "%s: %s(%d) > %s", Path.GetFileName(f.AbsolutePath), func, line, msg);
85 /// Prints a log message with the WARNING priority.
87 /// <param name="tag">The tag name of the log message.</param>
88 /// <param name="msg">The log message to print.</param>
89 /// <param name="file">The source file path of the caller function. This argument will be set automatically by the compiler.</param>
90 /// <param name="func">The function name of caller function. This argument will be set automatically by the compiler.</param>
91 /// <param name="line">The line number of calling position. This argument will be set automatically by the compiler.</param>
92 public static void Warn(string tag, string msg, [CallerFilePath] string file = "", [CallerMemberName] string func = "", [CallerLineNumber] int line = 0)
94 if (String.IsNullOrEmpty(file))
96 Interop.Dlog.Print(Interop.Dlog.LogPriority.DLOG_WARN, tag, "%s", msg);
100 Uri f = new Uri(file);
101 Interop.Dlog.Print(Interop.Dlog.LogPriority.DLOG_WARN, tag, "%s: %s(%d) > %s", Path.GetFileName(f.AbsolutePath), func, line, msg);
106 /// Prints a log message with the ERROR priority.
108 /// <param name="tag">The tag name of the log message.</param>
109 /// <param name="msg">The log message to print.</param>
110 /// <param name="file">The source file path of the caller function. This argument will be set automatically by the compiler.</param>
111 /// <param name="func">The function name of caller function. This argument will be set automatically by the compiler.</param>
112 /// <param name="line">The line number of calling position. This argument will be set automatically by the compiler.</param>
113 public static void Error(string tag, string msg, [CallerFilePath] string file = "", [CallerMemberName] string func = "", [CallerLineNumber] int line = 0)
115 if (String.IsNullOrEmpty(file))
117 Interop.Dlog.Print(Interop.Dlog.LogPriority.DLOG_ERROR, tag, "%s", msg);
121 Uri f = new Uri(file);
122 Interop.Dlog.Print(Interop.Dlog.LogPriority.DLOG_ERROR, tag, "%s: %s(%d) > %s", Path.GetFileName(f.AbsolutePath), func, line, msg);
127 /// Prints a log message with the FATAL priority.
129 /// <param name="tag">The tag name of the log message.</param>
130 /// <param name="msg">The log message to print.</param>
131 /// <param name="file">The source file path of the caller function. This argument will be set automatically by the compiler.</param>
132 /// <param name="func">The function name of caller function. This argument will be set automatically by the compiler.</param>
133 /// <param name="line">The line number of calling position. This argument will be set automatically by the compiler.</param>
134 public static void Fatal(string tag, string msg, [CallerFilePath] string file = "", [CallerMemberName] string func = "", [CallerLineNumber] int line = 0)
136 if (String.IsNullOrEmpty(file))
138 Interop.Dlog.Print(Interop.Dlog.LogPriority.DLOG_FATAL, tag, "%s", msg);
142 Uri f = new Uri(file);
143 Interop.Dlog.Print(Interop.Dlog.LogPriority.DLOG_FATAL, tag, "%s: %s(%d) > %s", Path.GetFileName(f.AbsolutePath), func, line, msg);