Skip to content

Commit

Permalink
New Sdk.TraceLevel property that allows to have Sensor SDK debug log …
Browse files Browse the repository at this point in the history
…messages in a regular .Net Trace.
  • Loading branch information
bibigone committed May 19, 2021
1 parent e8aa50c commit d1ed017
Show file tree
Hide file tree
Showing 8 changed files with 339 additions and 172 deletions.
10 changes: 9 additions & 1 deletion K4AdotNet.Samples.Wpf.BackgroundRemover/App.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,15 @@ internal class App : AppBase
{
[STAThread]
public static void Main()
=> new App().Run();
{
#if DEBUG
Sdk.TraceLevel = System.Diagnostics.TraceLevel.Info;
#else
Sdk.TraceLevel = System.Diagnostics.TraceLevel.Warning;
#endif

new App().Run();
}

protected override Window CreateMainWindow(StartupEventArgs e)
{
Expand Down
10 changes: 9 additions & 1 deletion K4AdotNet.Samples.Wpf.BodyTracker/App.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,15 @@ internal sealed class App : AppBase
{
[STAThread]
public static void Main()
=> new App().Run();
{
#if DEBUG
Sdk.TraceLevel = System.Diagnostics.TraceLevel.Info;
#else
Sdk.TraceLevel = System.Diagnostics.TraceLevel.Warning;
#endif

new App().Run();
}

protected override Window CreateMainWindow(StartupEventArgs e)
{
Expand Down
10 changes: 9 additions & 1 deletion K4AdotNet.Samples.Wpf.Viewer/App.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,15 @@ internal sealed class App : AppBase
{
[STAThread]
public static void Main()
=> new App().Run();
{
#if DEBUG
Sdk.TraceLevel = System.Diagnostics.TraceLevel.Info;
#else
Sdk.TraceLevel = System.Diagnostics.TraceLevel.Warning;
#endif

new App().Run();
}

protected override Window CreateMainWindow(StartupEventArgs e)
=> new MainWindow(new MainModel(this));
Expand Down
226 changes: 80 additions & 146 deletions K4AdotNet/K4AdotNet.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1258,6 +1258,79 @@
<exception cref="T:System.ObjectDisposedException">This method cannot be called for disposed objects.</exception>
<seealso cref="M:System.IDisposable.Dispose"/>
</member>
<member name="T:K4AdotNet.Logging.LogImpl">
<summary>
Internal helper class which implements logging-related logic.
</summary>
</member>
<member name="T:K4AdotNet.Logging.LogLevel">
<summary>Verbosity levels of debug messaging.</summary>
</member>
<member name="F:K4AdotNet.Logging.LogLevel.Critical">
<summary>The most severe level of debug messaging.</summary>
</member>
<member name="F:K4AdotNet.Logging.LogLevel.Error">
<summary>The second most severe level of debug messaging.</summary>
</member>
<member name="F:K4AdotNet.Logging.LogLevel.Warning">
<summary>The third most severe level of debug messaging.</summary>
</member>
<member name="F:K4AdotNet.Logging.LogLevel.Information">
<summary>The second least severe level of debug messaging.</summary>
</member>
<member name="F:K4AdotNet.Logging.LogLevel.Trace">
<summary>The lest severe level of debug messaging. This is the most verbose messaging possible.</summary>
</member>
<member name="F:K4AdotNet.Logging.LogLevel.Off">
<summary>No logging is performed.</summary>
</member>
<member name="T:K4AdotNet.Logging.NativeApi">
<summary>DLL imports from <c>k4a.h</c> header file for native functions that are connected with logging.</summary>
</member>
<member name="T:K4AdotNet.Logging.NativeApi.LoggingMessageCallback">
<summary>Callback function for debug messages being generated by the Azure Kinect SDK.</summary>
<param name="context">The context of the callback function. This is the context that was supplied by the caller to <see cref="M:K4AdotNet.Logging.NativeApi.SetDebugMessageHandler(K4AdotNet.Logging.NativeApi.LoggingMessageCallback,System.IntPtr,K4AdotNet.Logging.LogLevel)"/>.</param>
<param name="level">The level of the message that has been created.</param>
<param name="file">The file name of the source file that generated the message.</param>
<param name="line">The line number of the source file that generated the message.</param>
<param name="message">The messaged generated by the Azure Kinect SDK.</param>
<remarks><para>
The callback is called asynchronously when the Azure Kinext SDK generates a message at a <paramref name="level"/> that is equal to
or more critical than the level specified when calling <see cref="M:K4AdotNet.Logging.NativeApi.SetDebugMessageHandler(K4AdotNet.Logging.NativeApi.LoggingMessageCallback,System.IntPtr,K4AdotNet.Logging.LogLevel)"/> to register the callback.
</para><para>
This callback can occur from any thread and blocks the calling thread.This callback user
must protect it's logging resources from concurrent calls. All care should be made to minimize the amount of time
locks are held.
</para></remarks>
</member>
<member name="M:K4AdotNet.Logging.NativeApi.SetDebugMessageHandler(K4AdotNet.Logging.NativeApi.LoggingMessageCallback,System.IntPtr,K4AdotNet.Logging.LogLevel)">
<summary>Sets and clears the callback function to receive debug messages from the Azure Kinect device.</summary>
<param name="messageCallback">The callback function to receive messages from. Set to <see langword="null"/> to unregister the callback function.</param>
<param name="messageCallbackContext">The callback functions context.</param>
<param name="minLevel">The least critical error the user wants to be notified about.</param>
<returns>
<see cref="F:K4AdotNet.NativeCallResults.Result.Succeeded"/> if the callback function was set or cleared successfully.
<see cref="F:K4AdotNet.NativeCallResults.Result.Failed"/> if an error is encountered or the callback function has already been set.
</returns>
<remarks><para>
Call this function to set or clear the callback function that is used to deliver debug messages to the caller. This
callback may be called concurrently, it is up to the implementation of the callback function to ensure the
parallelization is handled.
</para><para>
Clearing the callback function will block until all pending calls to the callback function have completed.
</para><para>
To update <paramref name="minLevel"/>, this method can be called with the same value <paramref name="messageCallback"/> and by
specifying a new <paramref name="minLevel"/>.
</para><para>
Logging provided via this API is independent of the logging controlled by the environmental variable controls
<c>K4A_ENABLE_LOG_TO_STDOUT</c>, <c>K4A_ENABLE_LOG_TO_A_FILE</c>, and <c>K4A_LOG_LEVEL</c>. However there is a slight change in
default behavior when using this function.By default, when \p k4a_set_debug_message_handler() has not been used to
register a message callback, the default for environmental variable controls is to send debug messages as if
<c>K4A_ENABLE_LOG_TO_STDOUT= 1</c> were set. If this method registers a callback function before
<see cref="M:K4AdotNet.Sensor.NativeApi.DeviceOpen(System.UInt32,K4AdotNet.NativeHandles.DeviceHandle@)"/> is called, then the default for environmental controls
is as if <c>K4A_ENABLE_LOG_TO_STDOUT= 0</c> was specified. Physically specifying the environmental control will override the default.
</para></remarks>
</member>
<member name="T:K4AdotNet.Microseconds32">
<summary>32-bit time value in microseconds. Used for timestamps and delays.</summary>
<remarks>
Expand Down Expand Up @@ -4144,6 +4217,13 @@
<member name="F:K4AdotNet.Sdk.DLL_EXTENSION_WIN">
<summary>Extension of Dynamic Link Libraries (DLL) under Windows.</summary>
</member>
<member name="P:K4AdotNet.Sdk.TraceLevel">
<summary>
The K4A.Net can log data to a regular .Net Trace.
Use this property to choose the level of such logging, or set it to <see cref="F:System.Diagnostics.TraceLevel.Off"/> to turn it off.
Default value is <see cref="F:System.Diagnostics.TraceLevel.Off"/>.
</summary>
</member>
<member name="M:K4AdotNet.Sdk.ConfigureLogging(System.Diagnostics.TraceLevel,System.Boolean,System.String)">
<summary>The Sensor SDK can log data to the console, files, or to a custom handler.</summary>
<param name="level">Level of logging.</param>
Expand Down Expand Up @@ -7691,149 +7771,3 @@
</member>
</members>
</doc>
System.Diagnostics.CodeAnalysis.AllowNullAttribute">
<summary>
Specifies that <see langword="null"/> is allowed as an input even if the
corresponding type disallows it.
</summary>
</member>
<member name="M:System.Diagnostics.CodeAnalysis.AllowNullAttribute.#ctor">
<summary>
Initializes a new instance of the <see cref="T:System.Diagnostics.CodeAnalysis.AllowNullAttribute"/> class.
</summary>
</member>
<member name="T:System.Diagnostics.CodeAnalysis.DisallowNullAttribute">
<summary>
Specifies that <see langword="null"/> is disallowed as an input even if the
corresponding type allows it.
</summary>
</member>
<member name="M:System.Diagnostics.CodeAnalysis.DisallowNullAttribute.#ctor">
<summary>
Initializes a new instance of the <see cref="T:System.Diagnostics.CodeAnalysis.DisallowNullAttribute"/> class.
</summary>
</member>
<member name="T:System.Diagnostics.CodeAnalysis.DoesNotReturnAttribute">
<summary>
Specifies that a method that will never return under any circumstance.
</summary>
</member>
<member name="M:System.Diagnostics.CodeAnalysis.DoesNotReturnAttribute.#ctor">
<summary>
Initializes a new instance of the <see cref="T:System.Diagnostics.CodeAnalysis.DoesNotReturnAttribute"/> class.
</summary>

</member>
<member name="T:System.Diagnostics.CodeAnalysis.DoesNotReturnIfAttribute">
<summary>
Specifies that the method will not return if the associated <see cref="T:System.Boolean"/>
parameter is passed the specified value.
</summary>
</member>
<member name="P:System.Diagnostics.CodeAnalysis.DoesNotReturnIfAttribute.ParameterValue">
<summary>
Gets the condition parameter value.
Code after the method is considered unreachable by diagnostics if the argument
to the associated parameter matches this value.
</summary>
</member>
<member name="M:System.Diagnostics.CodeAnalysis.DoesNotReturnIfAttribute.#ctor(System.Boolean)">
<summary>
Initializes a new instance of the <see cref="T:System.Diagnostics.CodeAnalysis.DoesNotReturnIfAttribute"/>
class with the specified parameter value.
</summary>
<param name="parameterValue">
The condition parameter value.
Code after the method is considered unreachable by diagnostics if the argument
to the associated parameter matches this value.
</param>
</member>
<member name="T:System.Diagnostics.CodeAnalysis.MaybeNullAttribute">
<summary>
Specifies that an output may be <see langword="null"/> even if the
corresponding type disallows it.
</summary>
</member>
<member name="M:System.Diagnostics.CodeAnalysis.MaybeNullAttribute.#ctor">
<summary>
Initializes a new instance of the <see cref="T:System.Diagnostics.CodeAnalysis.MaybeNullAttribute"/> class.
</summary>
</member>
<member name="T:System.Diagnostics.CodeAnalysis.MaybeNullWhenAttribute">
<summary>
Specifies that when a method returns <see cref="P:System.Diagnostics.CodeAnalysis.MaybeNullWhenAttribute.ReturnValue"/>,
the parameter may be <see langword="null"/> even if the corresponding type disallows it.
</summary>
</member>
<member name="P:System.Diagnostics.CodeAnalysis.MaybeNullWhenAttribute.ReturnValue">
<summary>
Gets the return value condition.
If the method returns this value, the associated parameter may be <see langword="null"/>.
</summary>
</member>
<member name="M:System.Diagnostics.CodeAnalysis.MaybeNullWhenAttribute.#ctor(System.Boolean)">
<summary>
Initializes the attribute with the specified return value condition.
</summary>
<param name="returnValue">
The return value condition.
If the method returns this value, the associated parameter may be <see langword="null"/>.
</param>
</member>
<member name="T:System.Diagnostics.CodeAnalysis.NotNullAttribute">
<summary>
Specifies that an output is not <see langword="null"/> even if the
corresponding type allows it.
</summary>
</member>
<member name="M:System.Diagnostics.CodeAnalysis.NotNullAttribute.#ctor">
<summary>
Initializes a new instance of the <see cref="T:System.Diagnostics.CodeAnalysis.NotNullAttribute"/> class.
</summary>
</member>
<member name="T:System.Diagnostics.CodeAnalysis.NotNullIfNotNullAttribute">
<summary>
Specifies that the output will be non-<see langword="null"/> if the
named parameter is non-<see langword="null"/>.
</summary>
</member>
<member name="P:System.Diagnostics.CodeAnalysis.NotNullIfNotNullAttribute.ParameterName">
<summary>
Gets the associated parameter name.
The output will be non-<see langword="null"/> if the argument to the
parameter specified is non-<see langword="null"/>.
</summary>
</member>
<member name="M:System.Diagnostics.CodeAnalysis.NotNullIfNotNullAttribute.#ctor(System.String)">
<summary>
Initializes the attribute with the associated parameter name.
</summary>
<param name="parameterName">
The associated parameter name.
The output will be non-<see langword="null"/> if the argument to the
parameter specified is non-<see langword="null"/>.
</param>
</member>
<member name="T:System.Diagnostics.CodeAnalysis.NotNullWhenAttribute">
<summary>
Specifies that when a method returns <see cref="P:System.Diagnostics.CodeAnalysis.NotNullWhenAttribute.ReturnValue"/>,
the parameter will not be <see langword="null"/> even if the corresponding type allows it.
</summary>
</member>
<member name="P:System.Diagnostics.CodeAnalysis.NotNullWhenAttribute.ReturnValue">
<summary>
Gets the return value condition.
If the method returns this value, the associated parameter will not be <see langword="null"/>.
</summary>
</member>
<member name="M:System.Diagnostics.CodeAnalysis.NotNullWhenAttribute.#ctor(System.Boolean)">
<summary>
Initializes the attribute with the specified return value condition.
</summary>
<param name="returnValue">
The return value condition.
If the method returns this value, the associated parameter will not be <see langword="null"/>.
</param>
</member>
</members>
</doc>
Loading

0 comments on commit d1ed017

Please sign in to comment.