Class BaseContext
- Namespace
- VisioForge.Core
- Assembly
- VisioForge.Core.dll
Provides a base context class for logging operations and utility functions across the VisioForge SDK. This class serves as a foundation for other SDK components, offering centralized logging capabilities and shared utilities like random number generation.
public class BaseContextInheritance
Inherited Members
Properties
Rnd
Gets a shared random number generator instance for use across the SDK. This provides a convenient way to generate random values for various operations such as unique identifiers, test data, or randomization features.
public Random Rnd { get; }Property Value
Methods
Debug(string, string, string)
Log debug.
public void Debug(string class_, string method, string message)Parameters
Debug(string, string, string, Exception)
Log debug.
public void Debug(string class_, string method, string message, Exception ex)Parameters
class_string-
The class.
methodstring-
The method.
messagestring-
The message.
exException-
The exception.
Debug(string, string, Exception)
Log debug.
public void Debug(string class_, string method, Exception ex)Parameters
Error(string, string, string)
Logs an error message with structured context information including class and method names. The message will be written to both the configured Serilog logger and System.Diagnostics.Debug output. Messages containing "unregistered" are treated specially and only written to debug output.
public void Error(string class_, string method, string message)Parameters
class_string-
The name of the class where the error occurred.
methodstring-
The name of the method where the error occurred.
messagestring-
The error message to log.
Error(string, string, string, Exception)
Log error.
public void Error(string class_, string method, string message, Exception ex)Parameters
class_string-
The class.
methodstring-
The method.
messagestring-
The message.
exException-
The exception.
Error(string, string, Exception)
Log error.
public void Error(string class_, string method, Exception ex)Parameters
GetLogger()
Gets the current Serilog logger instance configured for this context.
public ILogger GetLogger()Returns
- ILogger
-
The current ILogger instance, or null if no logger has been set.
Info(string, string, string)
Log info.
public void Info(string class_, string method, string message)Parameters
Info(string, string, string, Exception)
Log info.
public void Info(string class_, string method, string message, Exception ex)Parameters
class_string-
The class.
methodstring-
The method.
messagestring-
The message.
exException-
The exception.
Info(string, string, Exception)
Log info.
public void Info(string class_, string method, Exception ex)Parameters
SetLogger(ILogger)
Sets the Serilog logger instance to be used for all logging operations in this context. This allows for centralized logging configuration and ensures consistent log formatting across all SDK components that inherit from this base context.
public void SetLogger(ILogger logger)Parameters
loggerILogger-
The Serilog logger instance to use for logging operations. Can be null to disable logging.
Warning(string, string, string)
Log warning.
public void Warning(string class_, string method, string message)Parameters
Warning(string, string, string, Exception)
Log warning.
public void Warning(string class_, string method, string message, Exception ex)Parameters
class_string-
The class.
methodstring-
The method.
messagestring-
The message.
exException-
The exception.
Warning(string, string, Exception)
Log warning.
public void Warning(string class_, string method, Exception ex)