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.
11 using System.Runtime.CompilerServices;
16 /// Provides methods to print log messages to Tizen logging system.
18 public static class Log
21 /// Prints a log message with the DEBUG priority.
23 /// <param name="tag">The tag name of the log message.</param>
24 /// <param name="message">The log message to print.</param>
25 /// <param name="file">The source file path of the caller function. This argument will be set automatically by the compiler.</param>
26 /// <param name="func">The function name of caller function. This argument will be set automatically by the compiler.</param>
27 /// <param name="line">The line number of calling position. This argument will be set automatically by the compiler.</param>
28 public static void Debug(string tag, string message, [CallerFilePath] string file = "", [CallerMemberName] string func = "", [CallerLineNumber] int line = 0)
30 if (String.IsNullOrEmpty(file))
32 Interop.Dlog.Print(Interop.Dlog.LogPriority.DLOG_DEBUG, tag, "%s", message);
36 Uri f = new Uri(file);
37 Interop.Dlog.Print(Interop.Dlog.LogPriority.DLOG_DEBUG, tag, "%s: %s(%d) > %s", Path.GetFileName(f.AbsolutePath), func, line, message);
42 /// Prints a log message with the VERBOSE priority.
44 /// <param name="tag">The tag name of the log message.</param>
45 /// <param name="message">The log message to print.</param>
46 /// <param name="file">The source file path of the caller function. This argument will be set automatically by the compiler.</param>
47 /// <param name="func">The function name of caller function. This argument will be set automatically by the compiler.</param>
48 /// <param name="line">The line number of calling position. This argument will be set automatically by the compiler.</param>
49 public static void Verbose(string tag, string message, [CallerFilePath] string file = "", [CallerMemberName] string func = "", [CallerLineNumber] int line = 0)
51 if (String.IsNullOrEmpty(file))
53 Interop.Dlog.Print(Interop.Dlog.LogPriority.DLOG_VERBOSE, tag, "%s", message);
57 Uri f = new Uri(file);
58 Interop.Dlog.Print(Interop.Dlog.LogPriority.DLOG_VERBOSE, tag, "%s: %s(%d) > %s", Path.GetFileName(f.AbsolutePath), func, line, message);
63 /// Prints a log message with the INFO priority.
65 /// <param name="tag">The tag name of the log message.</param>
66 /// <param name="message">The log message to print.</param>
67 /// <param name="file">The source file path of the caller function. This argument will be set automatically by the compiler.</param>
68 /// <param name="func">The function name of caller function. This argument will be set automatically by the compiler.</param>
69 /// <param name="line">The line number of calling position. This argument will be set automatically by the compiler.</param>
70 public static void Info(string tag, string message, [CallerFilePath] string file = "", [CallerMemberName] string func = "", [CallerLineNumber] int line = 0)
72 if (String.IsNullOrEmpty(file))
74 Interop.Dlog.Print(Interop.Dlog.LogPriority.DLOG_INFO, tag, "%s", message);
78 Uri f = new Uri(file);
79 Interop.Dlog.Print(Interop.Dlog.LogPriority.DLOG_INFO, tag, "%s: %s(%d) > %s", Path.GetFileName(f.AbsolutePath), func, line, message);
84 /// Prints a log message with the WARNING priority.
86 /// <param name="tag">The tag name of the log message.</param>
87 /// <param name="message">The log message to print.</param>
88 /// <param name="file">The source file path of the caller function. This argument will be set automatically by the compiler.</param>
89 /// <param name="func">The function name of caller function. This argument will be set automatically by the compiler.</param>
90 /// <param name="line">The line number of calling position. This argument will be set automatically by the compiler.</param>
91 public static void Warn(string tag, string message, [CallerFilePath] string file = "", [CallerMemberName] string func = "", [CallerLineNumber] int line = 0)
93 if (String.IsNullOrEmpty(file))
95 Interop.Dlog.Print(Interop.Dlog.LogPriority.DLOG_WARN, tag, "%s", message);
99 Uri f = new Uri(file);
100 Interop.Dlog.Print(Interop.Dlog.LogPriority.DLOG_WARN, tag, "%s: %s(%d) > %s", Path.GetFileName(f.AbsolutePath), func, line, message);
105 /// Prints a log message with the ERROR priority.
107 /// <param name="tag">The tag name of the log message.</param>
108 /// <param name="message">The log message to print.</param>
109 /// <param name="file">The source file path of the caller function. This argument will be set automatically by the compiler.</param>
110 /// <param name="func">The function name of caller function. This argument will be set automatically by the compiler.</param>
111 /// <param name="line">The line number of calling position. This argument will be set automatically by the compiler.</param>
112 public static void Error(string tag, string message, [CallerFilePath] string file = "", [CallerMemberName] string func = "", [CallerLineNumber] int line = 0)
114 if (String.IsNullOrEmpty(file))
116 Interop.Dlog.Print(Interop.Dlog.LogPriority.DLOG_ERROR, tag, "%s", message);
120 Uri f = new Uri(file);
121 Interop.Dlog.Print(Interop.Dlog.LogPriority.DLOG_ERROR, tag, "%s: %s(%d) > %s", Path.GetFileName(f.AbsolutePath), func, line, message);
126 /// Prints a log message with the FATAL priority.
128 /// <param name="tag">The tag name of the log message.</param>
129 /// <param name="message">The log message to print.</param>
130 /// <param name="file">The source file path of the caller function. This argument will be set automatically by the compiler.</param>
131 /// <param name="func">The function name of caller function. This argument will be set automatically by the compiler.</param>
132 /// <param name="line">The line number of calling position. This argument will be set automatically by the compiler.</param>
133 public static void Fatal(string tag, string message, [CallerFilePath] string file = "", [CallerMemberName] string func = "", [CallerLineNumber] int line = 0)
135 if (String.IsNullOrEmpty(file))
137 Interop.Dlog.Print(Interop.Dlog.LogPriority.DLOG_FATAL, tag, "%s", message);
141 Uri f = new Uri(file);
142 Interop.Dlog.Print(Interop.Dlog.LogPriority.DLOG_FATAL, tag, "%s: %s(%d) > %s", Path.GetFileName(f.AbsolutePath), func, line, message);