private static void WriteException(IBinaryWriter writer, LogEventException logEventException) { writer.WriteNullable(logEventException.Message, (w, s) => w.Write(s)); writer.WriteNullable(logEventException.Type, (w, s) => w.Write(s)); writer.WriteNullable(logEventException.Module, (w, s) => w.Write(s)); writer.WriteNullable(logEventException.Stack, (w, x) => w.WriteCollection(x, WriteStackFrame)); }
private static LogEventException CreateLogEventException(Exception ex) { var logEventException = new LogEventException { Module = ex.Source, Message = ex.Message, Type = ex.GetType().FullName }; var frames = new StackTrace(ex, true).GetFrames(); if (frames != null) { logEventException.Stack = frames.Select(CreateLogEventStackFrame).ToList(); } return(logEventException); }