Created
November 23, 2024 15:37
-
-
Save javierguerrero/382e43186c752fa756bf48214ced191f to your computer and use it in GitHub Desktop.
Ejemplo con Logging Estructurado en Serilog
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Log.Logger = new LoggerConfiguration() | |
.WriteTo.Console() | |
.CreateLogger(); | |
try | |
{ | |
throw new Exception("Error inesperado"); | |
} | |
catch (Exception ex) | |
{ | |
Log.ForContext("Usuario", "Juan") | |
.ForContext("Módulo", "Autenticación") | |
.Error(ex, "Excepción detectada en el módulo de autenticación"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment