Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save javierguerrero/382e43186c752fa756bf48214ced191f to your computer and use it in GitHub Desktop.
Save javierguerrero/382e43186c752fa756bf48214ced191f to your computer and use it in GitHub Desktop.
Ejemplo con Logging Estructurado en Serilog
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