Example #1
0
        /// <summary>
        /// Logs the error.
        /// </summary>
        /// <param name="session">The session.</param>
        /// <param name="message">The message.</param>
        /// <param name="stackTrace">The stack trace.</param>
        /// <param name="item">The item.</param>
        private void LogError(IESyncSession session, string message, string stackTrace = "", ProviderItem item = null)
        {
            if (session == null)
                return;

            try
            {
                var error = DynamicTypeManager.NewEditableRoot<IESyncError>(Constants.ESyncErrorProcessName);
                error.AllowLazyLoading = true;
                error.SessionId = session.Id;
                error.Message = message;
                error.StackTrace = stackTrace;
                error.Item = item != null ? item.GetXElement().ToString() : string.Empty;

                ((ISavable)error).Save();
            }
            catch (Exception ex)
            {
                Logger.Log(LogSeverity.Error, "LOG ESYNC ERROR", ex);
            }
        }
Example #2
0
        /// <summary>
        /// Logs the items retrieved.
        /// </summary>
        /// <param name="session">The session.</param>
        /// <param name="count">The count.</param>
        /// <returns>IESyncSession.</returns>
        private IESyncSession LogItemsRetrieved(IESyncSession session, int count)
        {
            if (session == null)
                return null;

            try
            {
                session.RecordsRetrieved = count;
                return (IESyncSession)((ISavable)session).Save();
            }
            catch (Exception ex)
            {
                Logger.Log(LogSeverity.Error, "ESYNC", ex);
            }

            return null;
        }