2 * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the License);
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an AS IS BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
19 using System.Runtime.InteropServices;
20 using System.Runtime.CompilerServices;
22 namespace Tizen.Runtime
24 internal static class ALog
26 const string Library = "libdlog.so.0";
27 const string Tag = "DOTNET_LAUNCHER";
29 internal enum LogPriority
43 public static void Debug(string message,
44 [CallerFilePath] string file = "",
45 [CallerMemberName] string function = "",
46 [CallerLineNumber] int line = 0)
48 Print(LogPriority.DLOG_DEBUG, Tag, message, file, function, line);
51 public static void Info(string message,
52 [CallerFilePath] string file = "",
53 [CallerMemberName] string function = "",
54 [CallerLineNumber] int line = 0)
56 Print(LogPriority.DLOG_INFO, Tag, message, file, function, line);
59 public static void Error(string message,
60 [CallerFilePath] string file = "",
61 [CallerMemberName] string function = "",
62 [CallerLineNumber] int line = 0)
64 Print(LogPriority.DLOG_ERROR, Tag, message, file, function, line);
67 [DllImportAttribute(Library, EntryPoint = "dlog_print")]
68 internal static extern int Print(LogPriority priority, string tag, string format, string file, string function, int line, string msg);
70 private static void Print(LogPriority priority, string tag, string message, string file, string function, int line)
72 FileInfo fileInfo = new FileInfo(file);
73 Print(priority, tag, "%s: %s(%d) > %s", fileInfo.Name, function, line, message);