Agregar archivos de proyecto.

This commit is contained in:
2026-05-14 09:52:12 +02:00
parent 3a8fc53e4e
commit f8102dd7f1
78 changed files with 34070 additions and 0 deletions

View File

@@ -0,0 +1,27 @@
Imports System.Runtime.CompilerServices
Imports Microsoft.Extensions.Logging
Public Module LoggerExtensions
'// Ejemplo de uso de la extensión LogVariable():
'//
'// ' Registrar información de una variable
'// Dim peassoVariable As String = "Hello, World!"
'// logger.LogVariable("peassoVariable", peassoVariable, LogLevel.Debug)
<Extension()>
Public Sub LogVariable(ByVal logger As ILogger, variableName As String, variableValue As Object, logLevel As LogLevel)
Try
If logger Is Nothing Then Throw New ArgumentNullException(NameOf(logger))
If variableName Is Nothing Then Throw New ArgumentNullException(NameOf(variableName))
Dim variableType As String = If(variableValue IsNot Nothing, variableValue.GetType().FullName, "Null")
Dim variableContent As String = If(variableValue IsNot Nothing, variableValue.ToString(), "Null")
Dim message As String = $"Variable Name: {variableName}, Type: {variableType}, Value: {variableContent}"
logger.Log(logLevel, New EventId(), message, exception:=Nothing, Function(s, e) s.ToString())
Catch ex As Exception
Debug.WriteLine($"Excepción en LoggerExtensions.LogVariable: {ex}")
End Try
End Sub
End Module