Class NVMathLog
- Namespace
- NVMathNet
- Assembly
- NVMath.Net.dll
Dependency-free logging hook. By default nothing is logged. Install a NVMathNet.NVMathLog.Handler to receive messages and bridge them to a logging framework, for example:
NVMathLog.MinimumLevel = NVMathLogLevel.Information;
NVMathLog.Handler = (level, category, message) =>
logger.Log(level switch { NVMathLogLevel.Error => LogLevel.Error, NVMathLogLevel.Warning => LogLevel.Warning,
NVMathLogLevel.Information => LogLevel.Information, _ => LogLevel.Debug },
"{Category}: {Message}", category, message);
The handler is invoked synchronously on the thread that produced the event, possibly from several threads at once, so it must be thread-safe and fast. Exceptions thrown by the handler are swallowed.
public static class NVMathLogInheritance
Inherited Members
Properties
Handler
Receives (level, category, message) for every message at or above NVMathNet.NVMathLog.MinimumLevel.
Categories are short library or component names such as cuFFT, Matmul or Loader.
null (the default) disables logging.
public static Action<NVMathLogLevel, string, string>? Handler { get; set; }Property Value
MinimumLevel
Messages below this level are not delivered to NVMathNet.NVMathLog.Handler. Default: NVMathNet.NVMathLogLevel.Information.
public static NVMathLogLevel MinimumLevel { get; set; }Property Value
Methods
IsEnabled(NVMathLogLevel)
Returns true if a message at level would be delivered.
public static bool IsEnabled(NVMathLogLevel level)Parameters
levelNVMathLogLevel