public static LogViewModel.MessageItem FromLogEvent(LogEventInfo logEventInfo) { string message = (logEventInfo.get_Exception() == null) ? string.Format("[{0}] {1}", logEventInfo.get_Level(), logEventInfo.get_Message()) : string.Format("[{0}] {1}", logEventInfo.get_Level(), logEventInfo.get_Exception().Message); return(new LogViewModel.MessageItem { Timestamp = logEventInfo.get_TimeStamp().ToShortDateString() + " " + logEventInfo.get_TimeStamp().ToLongTimeString(), Message = message }); }