private EntrySaveState InternalSaveEntry(Entry entry, TrackbackInfoCollection trackbackList, CrosspostInfoCollection crosspostList) { EntrySaveState rtn = EntrySaveState.Failed; // we want to prepopulate the cross post collection with the crosspost footer if (dasBlogSettings.SiteConfiguration.EnableCrossPostFooter && dasBlogSettings.SiteConfiguration.CrossPostFooter != null && dasBlogSettings.SiteConfiguration.CrossPostFooter.Length > 0) { foreach (CrosspostInfo info in crosspostList) { info.CrossPostFooter = dasBlogSettings.SiteConfiguration.CrossPostFooter; } } // now save the entry, passign in all the necessary Trackback and Pingback info. try { // if the post is missing a title don't publish it if (entry.Title == null || entry.Title.Length == 0) { entry.IsPublic = false; } // if the post is missing categories, then set the categories to empty string. if (entry.Categories == null) { entry.Categories = ""; } rtn = dataService.SaveEntry( entry, MaybeBuildWeblogPingInfo(), entry.IsPublic ? trackbackList : null, MaybeBuildPingbackInfo(entry), crosspostList); //TODO: SendEmail(entry, siteConfig, logService); } catch (Exception ex) { //TODO: Do something with this???? // StackTrace st = new StackTrace(); // logService.AddEvent(new EventDataItem(EventCodes.Error, ex.ToString() + Environment.NewLine + st.ToString(), "")); LoggedException le = new LoggedException("file failure", ex); var edi = new EventDataItem(EventCodes.Error, null , "Failed to Save a Post on {date}", System.DateTime.Now.ToShortDateString()); logger.LogError(edi, le); } // we want to invalidate all the caches so users get the new post // BreakCache(entry.GetSplitCategories()); return(rtn); }
public static void LogTrace(this ILogger logger, EventDataItem edi, LoggedException ex = null) { if (ex != null) { logger.LogTrace(100, ex, edi.UserMessage, edi.Params); } else { logger.LogTrace(100, edi.UserMessage, edi.Params); } }