Table of Contents

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 BaseContext

Inheritance

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

Random

Methods

Debug(string, string, string)

Log debug.

public void Debug(string class_, string method, string message)

Parameters

class_ string

The class.

method string

The method.

message string

The message.

Debug(string, string, string, Exception)

Log debug.

public void Debug(string class_, string method, string message, Exception ex)

Parameters

class_ string

The class.

method string

The method.

message string

The message.

ex Exception

The exception.

Debug(string, string, Exception)

Log debug.

public void Debug(string class_, string method, Exception ex)

Parameters

class_ string

The class.

method string

The method.

ex Exception

The exception.

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.

method string

The name of the method where the error occurred.

message string

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.

method string

The method.

message string

The message.

ex Exception

The exception.

Error(string, string, Exception)

Log error.

public void Error(string class_, string method, Exception ex)

Parameters

class_ string

The class.

method string

The method.

ex Exception

The exception.

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

class_ string

The class.

method string

The method.

message string

The message.

Info(string, string, string, Exception)

Log info.

public void Info(string class_, string method, string message, Exception ex)

Parameters

class_ string

The class.

method string

The method.

message string

The message.

ex Exception

The exception.

Info(string, string, Exception)

Log info.

public void Info(string class_, string method, Exception ex)

Parameters

class_ string

The class.

method string

The method.

ex Exception

The exception.

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

logger ILogger

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

class_ string

The class.

method string

The method.

message string

The message.

Warning(string, string, string, Exception)

Log warning.

public void Warning(string class_, string method, string message, Exception ex)

Parameters

class_ string

The class.

method string

The method.

message string

The message.

ex Exception

The exception.

Warning(string, string, Exception)

Log warning.

public void Warning(string class_, string method, Exception ex)

Parameters

class_ string

The class.

method string

The method.

ex Exception

The exception.