diff options
Diffstat (limited to 'Xamarin.Forms.Platform.Tizen/Log')
-rw-r--r-- | Xamarin.Forms.Platform.Tizen/Log/ConsoleLogger.cs | 68 | ||||
-rw-r--r-- | Xamarin.Forms.Platform.Tizen/Log/DlogLogger.cs | 41 | ||||
-rw-r--r-- | Xamarin.Forms.Platform.Tizen/Log/ILogger.cs | 71 | ||||
-rw-r--r-- | Xamarin.Forms.Platform.Tizen/Log/Log.cs | 989 | ||||
-rw-r--r-- | Xamarin.Forms.Platform.Tizen/Log/XamarinLogListener.cs | 20 |
5 files changed, 1189 insertions, 0 deletions
diff --git a/Xamarin.Forms.Platform.Tizen/Log/ConsoleLogger.cs b/Xamarin.Forms.Platform.Tizen/Log/ConsoleLogger.cs new file mode 100644 index 00000000..19e46e9e --- /dev/null +++ b/Xamarin.Forms.Platform.Tizen/Log/ConsoleLogger.cs @@ -0,0 +1,68 @@ +using System; +using System.IO; + +namespace Xamarin.Forms.Platform.Tizen +{ + /// <summary> + /// Logs a message to the console. + /// </summary> + internal class ConsoleLogger : ILogger + { + public void Debug(string tag, string message, string file, string func, int line) + { + Print("D", tag, message, file, func, line); + } + + public void Verbose(string tag, string message, string file, string func, int line) + { + Print("V", tag, message, file, func, line); + } + + public void Info(string tag, string message, string file, string func, int line) + { + Print("I", tag, message, file, func, line); + } + + public void Warn(string tag, string message, string file, string func, int line) + { + Print("W", tag, message, file, func, line); + } + + public void Error(string tag, string message, string file, string func, int line) + { + Print("E", tag, message, file, func, line); + } + + public void Fatal(string tag, string message, string file, string func, int line) + { + Print("F", tag, message, file, func, line); + } + + /// <summary> + /// Formats and prints the log information. + /// </summary> + /// <param name="level">Log level</param> + /// <param name="tag">Log tag</param> + /// <param name="message">Log message</param> + /// <param name="file">Full path to the file</param> + /// <param name="func">Function name</param> + /// <param name="line">Line number</param> + void Print(string level, string tag, string message, string file, string func, int line) + { + Uri f = new Uri(file); + Console.WriteLine( + String.Format( + "\n[{6:yyyy-MM-dd HH:mm:ss.ffff} {0}/{1}]\n{2}: {3}({4}) > {5}", + level, // 0 + tag, // 1 + Path.GetFileName(f.AbsolutePath), // 2 + func, // 3 + line, // 4 + message, // 5 + DateTime.Now // 6 + ) + ); + } + } +} + diff --git a/Xamarin.Forms.Platform.Tizen/Log/DlogLogger.cs b/Xamarin.Forms.Platform.Tizen/Log/DlogLogger.cs new file mode 100644 index 00000000..987a000a --- /dev/null +++ b/Xamarin.Forms.Platform.Tizen/Log/DlogLogger.cs @@ -0,0 +1,41 @@ +using T = Tizen; + +namespace Xamarin.Forms.Platform.Tizen +{ + /// <summary> + /// Logs a message to the dlog. + /// </summary> + internal class DlogLogger : ILogger + { + public void Debug(string tag, string message, string file, string func, int line) + { + T.Log.Debug(tag, message, file, func, line); + } + + public void Verbose(string tag, string message, string file, string func, int line) + { + T.Log.Verbose(tag, message, file, func, line); + } + + public void Info(string tag, string message, string file, string func, int line) + { + T.Log.Info(tag, message, file, func, line); + } + + public void Warn(string tag, string message, string file, string func, int line) + { + T.Log.Warn(tag, message, file, func, line); + } + + public void Error(string tag, string message, string file, string func, int line) + { + T.Log.Error(tag, message, file, func, line); + } + + public void Fatal(string tag, string message, string file, string func, int line) + { + T.Log.Fatal(tag, message, file, func, line); + } + } +} + diff --git a/Xamarin.Forms.Platform.Tizen/Log/ILogger.cs b/Xamarin.Forms.Platform.Tizen/Log/ILogger.cs new file mode 100644 index 00000000..6874641f --- /dev/null +++ b/Xamarin.Forms.Platform.Tizen/Log/ILogger.cs @@ -0,0 +1,71 @@ +using System; + +namespace Xamarin.Forms.Platform.Tizen +{ + /// <summary> + /// Reports log messages with various log levels. + /// </summary> + internal interface ILogger + { + /// <summary> + /// Reports a debug log message. + /// </summary> + /// <param name="tag">Log tag</param> + /// <param name="message">Log message</param> + /// <param name="file">Full path to the file</param> + /// <param name="func">Function name</param> + /// <param name="line">Line number</param> + void Debug(string tag, string message, string file, string func, int line); + + /// <summary> + /// Reports a verbose log message. + /// </summary> + /// <param name="tag">Log tag</param> + /// <param name="message">Log message</param> + /// <param name="file">Full path to the file</param> + /// <param name="func">Function name</param> + /// <param name="line">Line number</param> + void Verbose(string tag, string message, string file, string func, int line); + + /// <summary> + /// Reports an information log message. + /// </summary> + /// <param name="tag">Log tag</param> + /// <param name="message">Log message</param> + /// <param name="file">Full path to the file</param> + /// <param name="func">Function name</param> + /// <param name="line">Line number</param> + void Info(string tag, string message, string file, string func, int line); + + /// <summary> + /// Reports a warning log message. + /// </summary> + /// <param name="tag">Log tag</param> + /// <param name="message">Log message</param> + /// <param name="file">Full path to the file</param> + /// <param name="func">Function name</param> + /// <param name="line">Line number</param> + void Warn(string tag, string message, string file, string func, int line); + + /// <summary> + /// Reports an error log message. + /// </summary> + /// <param name="tag">Log tag</param> + /// <param name="message">Log message</param> + /// <param name="file">Full path to the file</param> + /// <param name="func">Function name</param> + /// <param name="line">Line number</param> + void Error(string tag, string message, string file, string func, int line); + + /// <summary> + /// Reports a fatal error log message. + /// </summary> + /// <param name="tag">Log tag</param> + /// <param name="message">Log message</param> + /// <param name="file">Full path to the file</param> + /// <param name="func">Function name</param> + /// <param name="line">Line number</param> + void Fatal(string tag, string message, string file, string func, int line); + } +} + diff --git a/Xamarin.Forms.Platform.Tizen/Log/Log.cs b/Xamarin.Forms.Platform.Tizen/Log/Log.cs new file mode 100644 index 00000000..3ebeb118 --- /dev/null +++ b/Xamarin.Forms.Platform.Tizen/Log/Log.cs @@ -0,0 +1,989 @@ +using System; +using System.Runtime.CompilerServices; + +namespace Xamarin.Forms.Platform.Tizen +{ + /// <summary> + /// Provides logging functionality. + /// </summary> + internal static class Log + { + static String _tag = "Xamarin"; + + static ILogger _logger = IsTizen() ? (ILogger)new DlogLogger() : (ILogger)new ConsoleLogger(); + + /// <summary> + /// Gets or sets the log tag. + /// </summary> + public static String Tag + { + get + { + return _tag; + } + set + { + _tag = value; + } + } + + /// <summary> + /// Gets or sets the logger used to report messages. + /// It's DlogLogger on a Tizen platform, ConsoleLogger on any other. + /// </summary> + public static ILogger Logger + { + get + { + return _logger; + } + set + { + _logger = value; + } + } + + public static void Debug(string message, + Guardian _ = default(Guardian), + [CallerFilePath] string file = "", + [CallerMemberName] string func = "", + [CallerLineNumber] int line = 0) + { + _logger.Debug(_tag, message, file, func, line); + } + + public static void Debug<T0>(string message, + T0 arg0, + Guardian _ = default(Guardian), + [CallerFilePath] string file = "", + [CallerMemberName] string func = "", + [CallerLineNumber] int line = 0) + { + Debug(String.Format(message, arg0), _, file, func, line); + } + + public static void Debug<T0, T1>(string message, + T0 arg0, + T1 arg1, + Guardian _ = default(Guardian), + [CallerFilePath] string file = "", + [CallerMemberName] string func = "", + [CallerLineNumber] int line = 0) + { + Debug(String.Format(message, arg0, arg1), _, file, func, line); + } + + public static void Debug<T0, T1, T2>(string message, + T0 arg0, + T1 arg1, + T2 arg2, + Guardian _ = default(Guardian), + [CallerFilePath] string file = "", + [CallerMemberName] string func = "", + [CallerLineNumber] int line = 0) + { + Debug(String.Format(message, arg0, arg1, arg2), _, file, func, line); + } + + public static void Debug<T0, T1, T2, T3>(string message, + T0 arg0, + T1 arg1, + T2 arg2, + T3 arg3, + Guardian _ = default(Guardian), + [CallerFilePath] string file = "", + [CallerMemberName] string func = "", + [CallerLineNumber] int line = 0) + { + Debug(String.Format(message, arg0, arg1, arg2, arg3), _, file, func, line); + } + + public static void Debug<T0, T1, T2, T3, T4>(string message, + T0 arg0, + T1 arg1, + T2 arg2, + T3 arg3, + T4 arg4, + Guardian _ = default(Guardian), + [CallerFilePath] string file = "", + [CallerMemberName] string func = "", + [CallerLineNumber] int line = 0) + { + Debug(String.Format(message, arg0, arg1, arg2, arg3, arg4), _, file, func, line); + } + + public static void Debug<T0, T1, T2, T3, T4, T5>(string message, + T0 arg0, + T1 arg1, + T2 arg2, + T3 arg3, + T4 arg4, + T5 arg5, + Guardian _ = default(Guardian), + [CallerFilePath] string file = "", + [CallerMemberName] string func = "", + [CallerLineNumber] int line = 0) + { + Debug(String.Format(message, arg0, arg1, arg2, arg3, arg4, arg5), _, file, func, line); + } + + public static void Debug<T0, T1, T2, T3, T4, T5, T6>(string message, + T0 arg0, + T1 arg1, + T2 arg2, + T3 arg3, + T4 arg4, + T5 arg5, + T6 arg6, + Guardian _ = default(Guardian), + [CallerFilePath] string file = "", + [CallerMemberName] string func = "", + [CallerLineNumber] int line = 0) + { + Debug(String.Format(message, arg0, arg1, arg2, arg3, arg4, arg5, arg6), _, file, func, line); + } + + public static void Debug<T0, T1, T2, T3, T4, T5, T6, T7>(string message, + T0 arg0, + T1 arg1, + T2 arg2, + T3 arg3, + T4 arg4, + T5 arg5, + T6 arg6, + T7 arg7, + Guardian _ = default(Guardian), + [CallerFilePath] string file = "", + [CallerMemberName] string func = "", + [CallerLineNumber] int line = 0) + { + Debug(String.Format(message, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7), _, file, func, line); + } + + public static void Debug<T0, T1, T2, T3, T4, T5, T6, T7, T8>(string message, + T0 arg0, + T1 arg1, + T2 arg2, + T3 arg3, + T4 arg4, + T5 arg5, + T6 arg6, + T7 arg7, + T8 arg8, + Guardian _ = default(Guardian), + [CallerFilePath] string file = "", + [CallerMemberName] string func = "", + [CallerLineNumber] int line = 0) + { + Debug(String.Format(message, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8), _, file, func, line); + } + + public static void Debug<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9>(string message, + T0 arg0, + T1 arg1, + T2 arg2, + T3 arg3, + T4 arg4, + T5 arg5, + T6 arg6, + T7 arg7, + T8 arg8, + T9 arg9, + Guardian _ = default(Guardian), + [CallerFilePath] string file = "", + [CallerMemberName] string func = "", + [CallerLineNumber] int line = 0) + { + Debug(String.Format(message, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9), _, file, func, line); + } + + public static void Verbose(string message, + Guardian _ = default(Guardian), + [CallerFilePath] string file = "", + [CallerMemberName] string func = "", + [CallerLineNumber] int line = 0) + { + _logger.Verbose(_tag, message, file, func, line); + } + + public static void Verbose<T0>(string message, + T0 arg0, + Guardian _ = default(Guardian), + [CallerFilePath] string file = "", + [CallerMemberName] string func = "", + [CallerLineNumber] int line = 0) + { + Verbose(String.Format(message, arg0), _, file, func, line); + } + + public static void Verbose<T0, T1>(string message, + T0 arg0, + T1 arg1, + Guardian _ = default(Guardian), + [CallerFilePath] string file = "", + [CallerMemberName] string func = "", + [CallerLineNumber] int line = 0) + { + Verbose(String.Format(message, arg0, arg1), _, file, func, line); + } + + public static void Verbose<T0, T1, T2>(string message, + T0 arg0, + T1 arg1, + T2 arg2, + Guardian _ = default(Guardian), + [CallerFilePath] string file = "", + [CallerMemberName] string func = "", + [CallerLineNumber] int line = 0) + { + Verbose(String.Format(message, arg0, arg1, arg2), _, file, func, line); + } + + public static void Verbose<T0, T1, T2, T3>(string message, + T0 arg0, + T1 arg1, + T2 arg2, + T3 arg3, + Guardian _ = default(Guardian), + [CallerFilePath] string file = "", + [CallerMemberName] string func = "", + [CallerLineNumber] int line = 0) + { + Verbose(String.Format(message, arg0, arg1, arg2, arg3), _, file, func, line); + } + + public static void Verbose<T0, T1, T2, T3, T4>(string message, + T0 arg0, + T1 arg1, + T2 arg2, + T3 arg3, + T4 arg4, + Guardian _ = default(Guardian), + [CallerFilePath] string file = "", + [CallerMemberName] string func = "", + [CallerLineNumber] int line = 0) + { + Verbose(String.Format(message, arg0, arg1, arg2, arg3, arg4), _, file, func, line); + } + + public static void Verbose<T0, T1, T2, T3, T4, T5>(string message, + T0 arg0, + T1 arg1, + T2 arg2, + T3 arg3, + T4 arg4, + T5 arg5, + Guardian _ = default(Guardian), + [CallerFilePath] string file = "", + [CallerMemberName] string func = "", + [CallerLineNumber] int line = 0) + { + Verbose(String.Format(message, arg0, arg1, arg2, arg3, arg4, arg5), _, file, func, line); + } + + public static void Verbose<T0, T1, T2, T3, T4, T5, T6>(string message, + T0 arg0, + T1 arg1, + T2 arg2, + T3 arg3, + T4 arg4, + T5 arg5, + T6 arg6, + Guardian _ = default(Guardian), + [CallerFilePath] string file = "", + [CallerMemberName] string func = "", + [CallerLineNumber] int line = 0) + { + Verbose(String.Format(message, arg0, arg1, arg2, arg3, arg4, arg5, arg6), _, file, func, line); + } + + public static void Verbose<T0, T1, T2, T3, T4, T5, T6, T7>(string message, + T0 arg0, + T1 arg1, + T2 arg2, + T3 arg3, + T4 arg4, + T5 arg5, + T6 arg6, + T7 arg7, + Guardian _ = default(Guardian), + [CallerFilePath] string file = "", + [CallerMemberName] string func = "", + [CallerLineNumber] int line = 0) + { + Verbose(String.Format(message, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7), _, file, func, line); + } + + public static void Verbose<T0, T1, T2, T3, T4, T5, T6, T7, T8>(string message, + T0 arg0, + T1 arg1, + T2 arg2, + T3 arg3, + T4 arg4, + T5 arg5, + T6 arg6, + T7 arg7, + T8 arg8, + Guardian _ = default(Guardian), + [CallerFilePath] string file = "", + [CallerMemberName] string func = "", + [CallerLineNumber] int line = 0) + { + Verbose(String.Format(message, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8), _, file, func, line); + } + + public static void Verbose<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9>(string message, + T0 arg0, + T1 arg1, + T2 arg2, + T3 arg3, + T4 arg4, + T5 arg5, + T6 arg6, + T7 arg7, + T8 arg8, + T9 arg9, + Guardian _ = default(Guardian), + [CallerFilePath] string file = "", + [CallerMemberName] string func = "", + [CallerLineNumber] int line = 0) + { + Verbose(String.Format(message, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9), _, file, func, line); + } + + public static void Info(string message, + Guardian _ = default(Guardian), + [CallerFilePath] string file = "", + [CallerMemberName] string func = "", + [CallerLineNumber] int line = 0) + { + _logger.Info(_tag, message, file, func, line); + } + + public static void Info<T0>(string message, + T0 arg0, + Guardian _ = default(Guardian), + [CallerFilePath] string file = "", + [CallerMemberName] string func = "", + [CallerLineNumber] int line = 0) + { + Info(String.Format(message, arg0), _, file, func, line); + } + + public static void Info<T0, T1>(string message, + T0 arg0, + T1 arg1, + Guardian _ = default(Guardian), + [CallerFilePath] string file = "", + [CallerMemberName] string func = "", + [CallerLineNumber] int line = 0) + { + Info(String.Format(message, arg0, arg1), _, file, func, line); + } + + public static void Info<T0, T1, T2>(string message, + T0 arg0, + T1 arg1, + T2 arg2, + Guardian _ = default(Guardian), + [CallerFilePath] string file = "", + [CallerMemberName] string func = "", + [CallerLineNumber] int line = 0) + { + Info(String.Format(message, arg0, arg1, arg2), _, file, func, line); + } + + public static void Info<T0, T1, T2, T3>(string message, + T0 arg0, + T1 arg1, + T2 arg2, + T3 arg3, + Guardian _ = default(Guardian), + [CallerFilePath] string file = "", + [CallerMemberName] string func = "", + [CallerLineNumber] int line = 0) + { + Info(String.Format(message, arg0, arg1, arg2, arg3), _, file, func, line); + } + + public static void Info<T0, T1, T2, T3, T4>(string message, + T0 arg0, + T1 arg1, + T2 arg2, + T3 arg3, + T4 arg4, + Guardian _ = default(Guardian), + [CallerFilePath] string file = "", + [CallerMemberName] string func = "", + [CallerLineNumber] int line = 0) + { + Info(String.Format(message, arg0, arg1, arg2, arg3, arg4), _, file, func, line); + } + + public static void Info<T0, T1, T2, T3, T4, T5>(string message, + T0 arg0, + T1 arg1, + T2 arg2, + T3 arg3, + T4 arg4, + T5 arg5, + Guardian _ = default(Guardian), + [CallerFilePath] string file = "", + [CallerMemberName] string func = "", + [CallerLineNumber] int line = 0) + { + Info(String.Format(message, arg0, arg1, arg2, arg3, arg4, arg5), _, file, func, line); + } + + public static void Info<T0, T1, T2, T3, T4, T5, T6>(string message, + T0 arg0, + T1 arg1, + T2 arg2, + T3 arg3, + T4 arg4, + T5 arg5, + T6 arg6, + Guardian _ = default(Guardian), + [CallerFilePath] string file = "", + [CallerMemberName] string func = "", + [CallerLineNumber] int line = 0) + { + Info(String.Format(message, arg0, arg1, arg2, arg3, arg4, arg5, arg6), _, file, func, line); + } + + public static void Info<T0, T1, T2, T3, T4, T5, T6, T7>(string message, + T0 arg0, + T1 arg1, + T2 arg2, + T3 arg3, + T4 arg4, + T5 arg5, + T6 arg6, + T7 arg7, + Guardian _ = default(Guardian), + [CallerFilePath] string file = "", + [CallerMemberName] string func = "", + [CallerLineNumber] int line = 0) + { + Info(String.Format(message, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7), _, file, func, line); + } + + public static void Info<T0, T1, T2, T3, T4, T5, T6, T7, T8>(string message, + T0 arg0, + T1 arg1, + T2 arg2, + T3 arg3, + T4 arg4, + T5 arg5, + T6 arg6, + T7 arg7, + T8 arg8, + Guardian _ = default(Guardian), + [CallerFilePath] string file = "", + [CallerMemberName] string func = "", + [CallerLineNumber] int line = 0) + { + Info(String.Format(message, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8), _, file, func, line); + } + + public static void Info<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9>(string message, + T0 arg0, + T1 arg1, + T2 arg2, + T3 arg3, + T4 arg4, + T5 arg5, + T6 arg6, + T7 arg7, + T8 arg8, + T9 arg9, + Guardian _ = default(Guardian), + [CallerFilePath] string file = "", + [CallerMemberName] string func = "", + [CallerLineNumber] int line = 0) + { + Info(String.Format(message, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9), _, file, func, line); + } + + public static void Warn(string message, + Guardian _ = default(Guardian), + [CallerFilePath] string file = "", + [CallerMemberName] string func = "", + [CallerLineNumber] int line = 0) + { + _logger.Warn(_tag, message, file, func, line); + } + + public static void Warn<T0>(string message, + T0 arg0, + Guardian _ = default(Guardian), + [CallerFilePath] string file = "", + [CallerMemberName] string func = "", + [CallerLineNumber] int line = 0) + { + Warn(String.Format(message, arg0), _, file, func, line); + } + + public static void Warn<T0, T1>(string message, + T0 arg0, + T1 arg1, + Guardian _ = default(Guardian), + [CallerFilePath] string file = "", + [CallerMemberName] string func = "", + [CallerLineNumber] int line = 0) + { + Warn(String.Format(message, arg0, arg1), _, file, func, line); + } + + public static void Warn<T0, T1, T2>(string message, + T0 arg0, + T1 arg1, + T2 arg2, + Guardian _ = default(Guardian), + [CallerFilePath] string file = "", + [CallerMemberName] string func = "", + [CallerLineNumber] int line = 0) + { + Warn(String.Format(message, arg0, arg1, arg2), _, file, func, line); + } + + public static void Warn<T0, T1, T2, T3>(string message, + T0 arg0, + T1 arg1, + T2 arg2, + T3 arg3, + Guardian _ = default(Guardian), + [CallerFilePath] string file = "", + [CallerMemberName] string func = "", + [CallerLineNumber] int line = 0) + { + Warn(String.Format(message, arg0, arg1, arg2, arg3), _, file, func, line); + } + + public static void Warn<T0, T1, T2, T3, T4>(string message, + T0 arg0, + T1 arg1, + T2 arg2, + T3 arg3, + T4 arg4, + Guardian _ = default(Guardian), + [CallerFilePath] string file = "", + [CallerMemberName] string func = "", + [CallerLineNumber] int line = 0) + { + Warn(String.Format(message, arg0, arg1, arg2, arg3, arg4), _, file, func, line); + } + + public static void Warn<T0, T1, T2, T3, T4, T5>(string message, + T0 arg0, + T1 arg1, + T2 arg2, + T3 arg3, + T4 arg4, + T5 arg5, + Guardian _ = default(Guardian), + [CallerFilePath] string file = "", + [CallerMemberName] string func = "", + [CallerLineNumber] int line = 0) + { + Warn(String.Format(message, arg0, arg1, arg2, arg3, arg4, arg5), _, file, func, line); + } + + public static void Warn<T0, T1, T2, T3, T4, T5, T6>(string message, + T0 arg0, + T1 arg1, + T2 arg2, + T3 arg3, + T4 arg4, + T5 arg5, + T6 arg6, + Guardian _ = default(Guardian), + [CallerFilePath] string file = "", + [CallerMemberName] string func = "", + [CallerLineNumber] int line = 0) + { + Warn(String.Format(message, arg0, arg1, arg2, arg3, arg4, arg5, arg6), _, file, func, line); + } + + public static void Warn<T0, T1, T2, T3, T4, T5, T6, T7>(string message, + T0 arg0, + T1 arg1, + T2 arg2, + T3 arg3, + T4 arg4, + T5 arg5, + T6 arg6, + T7 arg7, + Guardian _ = default(Guardian), + [CallerFilePath] string file = "", + [CallerMemberName] string func = "", + [CallerLineNumber] int line = 0) + { + Warn(String.Format(message, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7), _, file, func, line); + } + + public static void Warn<T0, T1, T2, T3, T4, T5, T6, T7, T8>(string message, + T0 arg0, + T1 arg1, + T2 arg2, + T3 arg3, + T4 arg4, + T5 arg5, + T6 arg6, + T7 arg7, + T8 arg8, + Guardian _ = default(Guardian), + [CallerFilePath] string file = "", + [CallerMemberName] string func = "", + [CallerLineNumber] int line = 0) + { + Warn(String.Format(message, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8), _, file, func, line); + } + + public static void Warn<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9>(string message, + T0 arg0, + T1 arg1, + T2 arg2, + T3 arg3, + T4 arg4, + T5 arg5, + T6 arg6, + T7 arg7, + T8 arg8, + T9 arg9, + Guardian _ = default(Guardian), + [CallerFilePath] string file = "", + [CallerMemberName] string func = "", + [CallerLineNumber] int line = 0) + { + Warn(String.Format(message, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9), _, file, func, line); + } + + public static void Error(string message, + Guardian _ = default(Guardian), + [CallerFilePath] string file = "", + [CallerMemberName] string func = "", + [CallerLineNumber] int line = 0) + { + _logger.Error(_tag, message, file, func, line); + } + + public static void Error<T0>(string message, + T0 arg0, + Guardian _ = default(Guardian), + [CallerFilePath] string file = "", + [CallerMemberName] string func = "", + [CallerLineNumber] int line = 0) + { + Error(String.Format(message, arg0), _, file, func, line); + } + + public static void Error<T0, T1>(string message, + T0 arg0, + T1 arg1, + Guardian _ = default(Guardian), + [CallerFilePath] string file = "", + [CallerMemberName] string func = "", + [CallerLineNumber] int line = 0) + { + Error(String.Format(message, arg0, arg1), _, file, func, line); + } + + public static void Error<T0, T1, T2>(string message, + T0 arg0, + T1 arg1, + T2 arg2, + Guardian _ = default(Guardian), + [CallerFilePath] string file = "", + [CallerMemberName] string func = "", + [CallerLineNumber] int line = 0) + { + Error(String.Format(message, arg0, arg1, arg2), _, file, func, line); + } + + public static void Error<T0, T1, T2, T3>(string message, + T0 arg0, + T1 arg1, + T2 arg2, + T3 arg3, + Guardian _ = default(Guardian), + [CallerFilePath] string file = "", + [CallerMemberName] string func = "", + [CallerLineNumber] int line = 0) + { + Error(String.Format(message, arg0, arg1, arg2, arg3), _, file, func, line); + } + + public static void Error<T0, T1, T2, T3, T4>(string message, + T0 arg0, + T1 arg1, + T2 arg2, + T3 arg3, + T4 arg4, + Guardian _ = default(Guardian), + [CallerFilePath] string file = "", + [CallerMemberName] string func = "", + [CallerLineNumber] int line = 0) + { + Error(String.Format(message, arg0, arg1, arg2, arg3, arg4), _, file, func, line); + } + + public static void Error<T0, T1, T2, T3, T4, T5>(string message, + T0 arg0, + T1 arg1, + T2 arg2, + T3 arg3, + T4 arg4, + T5 arg5, + Guardian _ = default(Guardian), + [CallerFilePath] string file = "", + [CallerMemberName] string func = "", + [CallerLineNumber] int line = 0) + { + Error(String.Format(message, arg0, arg1, arg2, arg3, arg4, arg5), _, file, func, line); + } + + public static void Error<T0, T1, T2, T3, T4, T5, T6>(string message, + T0 arg0, + T1 arg1, + T2 arg2, + T3 arg3, + T4 arg4, + T5 arg5, + T6 arg6, + Guardian _ = default(Guardian), + [CallerFilePath] string file = "", + [CallerMemberName] string func = "", + [CallerLineNumber] int line = 0) + { + Error(String.Format(message, arg0, arg1, arg2, arg3, arg4, arg5, arg6), _, file, func, line); + } + + public static void Error<T0, T1, T2, T3, T4, T5, T6, T7>(string message, + T0 arg0, + T1 arg1, + T2 arg2, + T3 arg3, + T4 arg4, + T5 arg5, + T6 arg6, + T7 arg7, + Guardian _ = default(Guardian), + [CallerFilePath] string file = "", + [CallerMemberName] string func = "", + [CallerLineNumber] int line = 0) + { + Error(String.Format(message, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7), _, file, func, line); + } + + public static void Error<T0, T1, T2, T3, T4, T5, T6, T7, T8>(string message, + T0 arg0, + T1 arg1, + T2 arg2, + T3 arg3, + T4 arg4, + T5 arg5, + T6 arg6, + T7 arg7, + T8 arg8, + Guardian _ = default(Guardian), + [CallerFilePath] string file = "", + [CallerMemberName] string func = "", + [CallerLineNumber] int line = 0) + { + Error(String.Format(message, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8), _, file, func, line); + } + + public static void Error<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9>(string message, + T0 arg0, + T1 arg1, + T2 arg2, + T3 arg3, + T4 arg4, + T5 arg5, + T6 arg6, + T7 arg7, + T8 arg8, + T9 arg9, + Guardian _ = default(Guardian), + [CallerFilePath] string file = "", + [CallerMemberName] string func = "", + [CallerLineNumber] int line = 0) + { + Error(String.Format(message, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9), _, file, func, line); + } + + public static void Fatal(string message, + Guardian _ = default(Guardian), + [CallerFilePath] string file = "", + [CallerMemberName] string func = "", + [CallerLineNumber] int line = 0) + { + _logger.Fatal(_tag, message, file, func, line); + } + + public static void Fatal<T0>(string message, + T0 arg0, + Guardian _ = default(Guardian), + [CallerFilePath] string file = "", + [CallerMemberName] string func = "", + [CallerLineNumber] int line = 0) + { + Fatal(String.Format(message, arg0), _, file, func, line); + } + + public static void Fatal<T0, T1>(string message, + T0 arg0, + T1 arg1, + Guardian _ = default(Guardian), + [CallerFilePath] string file = "", + [CallerMemberName] string func = "", + [CallerLineNumber] int line = 0) + { + Fatal(String.Format(message, arg0, arg1), _, file, func, line); + } + + public static void Fatal<T0, T1, T2>(string message, + T0 arg0, + T1 arg1, + T2 arg2, + Guardian _ = default(Guardian), + [CallerFilePath] string file = "", + [CallerMemberName] string func = "", + [CallerLineNumber] int line = 0) + { + Fatal(String.Format(message, arg0, arg1, arg2), _, file, func, line); + } + + public static void Fatal<T0, T1, T2, T3>(string message, + T0 arg0, + T1 arg1, + T2 arg2, + T3 arg3, + Guardian _ = default(Guardian), + [CallerFilePath] string file = "", + [CallerMemberName] string func = "", + [CallerLineNumber] int line = 0) + { + Fatal(String.Format(message, arg0, arg1, arg2, arg3), _, file, func, line); + } + + public static void Fatal<T0, T1, T2, T3, T4>(string message, + T0 arg0, + T1 arg1, + T2 arg2, + T3 arg3, + T4 arg4, + Guardian _ = default(Guardian), + [CallerFilePath] string file = "", + [CallerMemberName] string func = "", + [CallerLineNumber] int line = 0) + { + Fatal(String.Format(message, arg0, arg1, arg2, arg3, arg4), _, file, func, line); + } + + public static void Fatal<T0, T1, T2, T3, T4, T5>(string message, + T0 arg0, + T1 arg1, + T2 arg2, + T3 arg3, + T4 arg4, + T5 arg5, + Guardian _ = default(Guardian), + [CallerFilePath] string file = "", + [CallerMemberName] string func = "", + [CallerLineNumber] int line = 0) + { + Fatal(String.Format(message, arg0, arg1, arg2, arg3, arg4, arg5), _, file, func, line); + } + + public static void Fatal<T0, T1, T2, T3, T4, T5, T6>(string message, + T0 arg0, + T1 arg1, + T2 arg2, + T3 arg3, + T4 arg4, + T5 arg5, + T6 arg6, + Guardian _ = default(Guardian), + [CallerFilePath] string file = "", + [CallerMemberName] string func = "", + [CallerLineNumber] int line = 0) + { + Fatal(String.Format(message, arg0, arg1, arg2, arg3, arg4, arg5, arg6), _, file, func, line); + } + + public static void Fatal<T0, T1, T2, T3, T4, T5, T6, T7>(string message, + T0 arg0, + T1 arg1, + T2 arg2, + T3 arg3, + T4 arg4, + T5 arg5, + T6 arg6, + T7 arg7, + Guardian _ = default(Guardian), + [CallerFilePath] string file = "", + [CallerMemberName] string func = "", + [CallerLineNumber] int line = 0) + { + Fatal(String.Format(message, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7), _, file, func, line); + } + + public static void Fatal<T0, T1, T2, T3, T4, T5, T6, T7, T8>(string message, + T0 arg0, + T1 arg1, + T2 arg2, + T3 arg3, + T4 arg4, + T5 arg5, + T6 arg6, + T7 arg7, + T8 arg8, + Guardian _ = default(Guardian), + [CallerFilePath] string file = "", + [CallerMemberName] string func = "", + [CallerLineNumber] int line = 0) + { + Fatal(String.Format(message, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8), _, file, func, line); + } + + public static void Fatal<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9>(string message, + T0 arg0, + T1 arg1, + T2 arg2, + T3 arg3, + T4 arg4, + T5 arg5, + T6 arg6, + T7 arg7, + T8 arg8, + T9 arg9, + Guardian _ = default(Guardian), + [CallerFilePath] string file = "", + [CallerMemberName] string func = "", + [CallerLineNumber] int line = 0) + { + Fatal(String.Format(message, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9), _, file, func, line); + } + + /// <summary> + /// Determines if Xamarin is running in a Tizen environment. + /// </summary> + /// <returns><c>true</c> if application is running on Tizen; otherwise, <c>false</c>.</returns> + static bool IsTizen() + { + return System.IO.File.Exists("/etc/tizen-release"); + } + + /// <summary> + /// A helper class, it allows to separate optional parameters from non-optional ones. + /// In case of any compilation errors, please make sure you're not using + /// explicit <c>null</c> value as one of the parameters. + /// </summary> + internal struct Guardian + { + } + } +} + diff --git a/Xamarin.Forms.Platform.Tizen/Log/XamarinLogListener.cs b/Xamarin.Forms.Platform.Tizen/Log/XamarinLogListener.cs new file mode 100644 index 00000000..02bdb0f1 --- /dev/null +++ b/Xamarin.Forms.Platform.Tizen/Log/XamarinLogListener.cs @@ -0,0 +1,20 @@ +using System; + +namespace Xamarin.Forms.Platform.Tizen +{ + internal class XamarinLogListener : LogListener + { + public XamarinLogListener() + { + } + + #region implemented abstract members of LogListener + + public override void Warning(string category, string message) + { + Log.Warn("[{0}] {1}", category, message); + } + + #endregion + } +} |