Log.cs 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301
  1. // WARNING - AUTOGENERATED - DO NOT EDIT
  2. //
  3. // Generated using `sharpie urho`
  4. //
  5. // Log.cs
  6. //
  7. // Copyright 2015 Xamarin Inc. All rights reserved.
  8. using System;
  9. using System.Runtime.InteropServices;
  10. using System.Collections.Generic;
  11. using Urho.Urho2D;
  12. using Urho.Gui;
  13. using Urho.Resources;
  14. using Urho.IO;
  15. using Urho.Navigation;
  16. using Urho.Network;
  17. namespace Urho.IO
  18. {
  19. /// <summary>
  20. /// Logging subsystem.
  21. /// </summary>
  22. public unsafe partial class Log : UrhoObject
  23. {
  24. unsafe partial void OnLogCreated ();
  25. [Preserve]
  26. public Log (IntPtr handle) : base (handle)
  27. {
  28. OnLogCreated ();
  29. }
  30. [Preserve]
  31. protected Log (UrhoObjectFlag emptyFlag) : base (emptyFlag)
  32. {
  33. OnLogCreated ();
  34. }
  35. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  36. internal static extern int Log_GetType (IntPtr handle);
  37. private StringHash UrhoGetType ()
  38. {
  39. Runtime.ValidateRefCounted (this);
  40. return new StringHash (Log_GetType (handle));
  41. }
  42. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  43. internal static extern IntPtr Log_GetTypeName (IntPtr handle);
  44. private string GetTypeName ()
  45. {
  46. Runtime.ValidateRefCounted (this);
  47. return Marshal.PtrToStringAnsi (Log_GetTypeName (handle));
  48. }
  49. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  50. internal static extern int Log_GetTypeStatic ();
  51. private static StringHash GetTypeStatic ()
  52. {
  53. Runtime.Validate (typeof(Log));
  54. return new StringHash (Log_GetTypeStatic ());
  55. }
  56. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  57. internal static extern IntPtr Log_GetTypeNameStatic ();
  58. private static string GetTypeNameStatic ()
  59. {
  60. Runtime.Validate (typeof(Log));
  61. return Marshal.PtrToStringAnsi (Log_GetTypeNameStatic ());
  62. }
  63. [Preserve]
  64. public Log () : this (Application.CurrentContext)
  65. {
  66. }
  67. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  68. internal static extern IntPtr Log_Log (IntPtr context);
  69. [Preserve]
  70. public Log (Context context) : base (UrhoObjectFlag.Empty)
  71. {
  72. Runtime.Validate (typeof(Log));
  73. handle = Log_Log ((object)context == null ? IntPtr.Zero : context.Handle);
  74. Runtime.RegisterObject (this);
  75. OnLogCreated ();
  76. }
  77. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  78. internal static extern void Log_Open (IntPtr handle, string fileName);
  79. /// <summary>
  80. /// Open the log file.
  81. /// </summary>
  82. public void Open (string fileName)
  83. {
  84. Runtime.ValidateRefCounted (this);
  85. Log_Open (handle, fileName);
  86. }
  87. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  88. internal static extern void Log_Close (IntPtr handle);
  89. /// <summary>
  90. /// Close the log file.
  91. /// </summary>
  92. public void Close ()
  93. {
  94. Runtime.ValidateRefCounted (this);
  95. Log_Close (handle);
  96. }
  97. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  98. internal static extern void Log_SetLevel (IntPtr handle, int level);
  99. /// <summary>
  100. /// Set logging level.
  101. /// </summary>
  102. private void SetLevel (int level)
  103. {
  104. Runtime.ValidateRefCounted (this);
  105. Log_SetLevel (handle, level);
  106. }
  107. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  108. internal static extern void Log_SetTimeStamp (IntPtr handle, bool enable);
  109. /// <summary>
  110. /// Set whether to timestamp log messages.
  111. /// </summary>
  112. private void SetTimeStamp (bool enable)
  113. {
  114. Runtime.ValidateRefCounted (this);
  115. Log_SetTimeStamp (handle, enable);
  116. }
  117. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  118. internal static extern void Log_SetQuiet (IntPtr handle, bool quiet);
  119. /// <summary>
  120. /// Set quiet mode ie. only print error entries to standard error stream (which is normally redirected to console also). Output to log file is not affected by this mode.
  121. /// </summary>
  122. private void SetQuiet (bool quiet)
  123. {
  124. Runtime.ValidateRefCounted (this);
  125. Log_SetQuiet (handle, quiet);
  126. }
  127. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  128. internal static extern int Log_GetLevel (IntPtr handle);
  129. /// <summary>
  130. /// Return logging level.
  131. /// </summary>
  132. private int GetLevel ()
  133. {
  134. Runtime.ValidateRefCounted (this);
  135. return Log_GetLevel (handle);
  136. }
  137. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  138. internal static extern bool Log_GetTimeStamp (IntPtr handle);
  139. /// <summary>
  140. /// Return whether log messages are timestamped.
  141. /// </summary>
  142. private bool GetTimeStamp ()
  143. {
  144. Runtime.ValidateRefCounted (this);
  145. return Log_GetTimeStamp (handle);
  146. }
  147. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  148. internal static extern IntPtr Log_GetLastMessage (IntPtr handle);
  149. /// <summary>
  150. /// Return last log message.
  151. /// </summary>
  152. private string GetLastMessage ()
  153. {
  154. Runtime.ValidateRefCounted (this);
  155. return Marshal.PtrToStringAnsi (Log_GetLastMessage (handle));
  156. }
  157. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  158. internal static extern bool Log_IsQuiet (IntPtr handle);
  159. /// <summary>
  160. /// Return whether log is in quiet mode (only errors printed to standard error stream).
  161. /// </summary>
  162. private bool IsQuiet ()
  163. {
  164. Runtime.ValidateRefCounted (this);
  165. return Log_IsQuiet (handle);
  166. }
  167. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  168. internal static extern void Log_Write (int level, string message);
  169. /// <summary>
  170. /// Write to the log. If logging level is higher than the level of the message, the message is ignored.
  171. /// </summary>
  172. public static void Write (LogLevel level, string message)
  173. {
  174. Runtime.Validate (typeof(Log));
  175. Log_Write ((int)level, message);
  176. }
  177. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  178. internal static extern void Log_WriteRaw (string message, bool error);
  179. /// <summary>
  180. /// Write raw output to the log.
  181. /// </summary>
  182. public static void WriteRaw (string message, bool error = false)
  183. {
  184. Runtime.Validate (typeof(Log));
  185. Log_WriteRaw (message, error);
  186. }
  187. public override StringHash Type {
  188. get {
  189. return UrhoGetType ();
  190. }
  191. }
  192. public override string TypeName {
  193. get {
  194. return GetTypeName ();
  195. }
  196. }
  197. [Preserve]
  198. public static StringHash TypeStatic {
  199. get {
  200. return GetTypeStatic ();
  201. }
  202. }
  203. public static string TypeNameStatic {
  204. get {
  205. return GetTypeNameStatic ();
  206. }
  207. }
  208. /// <summary>
  209. /// Return logging level.
  210. /// Or
  211. /// Set logging level.
  212. /// </summary>
  213. public int Level {
  214. get {
  215. return GetLevel ();
  216. }
  217. set {
  218. SetLevel (value);
  219. }
  220. }
  221. /// <summary>
  222. /// Return whether log messages are timestamped.
  223. /// Or
  224. /// Set whether to timestamp log messages.
  225. /// </summary>
  226. public bool TimeStamp {
  227. get {
  228. return GetTimeStamp ();
  229. }
  230. set {
  231. SetTimeStamp (value);
  232. }
  233. }
  234. /// <summary>
  235. /// Return whether log is in quiet mode (only errors printed to standard error stream).
  236. /// Or
  237. /// Set quiet mode ie. only print error entries to standard error stream (which is normally redirected to console also). Output to log file is not affected by this mode.
  238. /// </summary>
  239. public bool Quiet {
  240. get {
  241. return IsQuiet ();
  242. }
  243. set {
  244. SetQuiet (value);
  245. }
  246. }
  247. /// <summary>
  248. /// Return last log message.
  249. /// </summary>
  250. public string LastMessage {
  251. get {
  252. return GetLastMessage ();
  253. }
  254. }
  255. }
  256. }