Example #1
0
        private void LogError(ErrorMessageResID resID, string logSource, Exception exp, params object[] args)
        {
            try
            {
                StringBuilder messageBuilder = new StringBuilder();
                if (args != null && args.Length > 0)
                {
                    //messageBuilder.AppendLine(string.Format(CultureInfo.InvariantCulture, ResourceManager.GetErrorMessage(resID), args));
                }
                else
                {
                    //messageBuilder.AppendLine(ResourceManager.GetErrorMessage(resID));
                }
                if (!logSource.Equals(string.Empty))
                {
                    messageBuilder.AppendLine("Log Source : " + logSource);
                }

                messageBuilder.AppendLine(GetExceptionMessage(exp));
                LogEntry log = new LogEntry();
                log.Message  = messageBuilder.ToString();
                log.Priority = 5;
                log.EventId  = resID.GetHashCode();
                log.Categories.Clear();
                log.Categories.Add("Error Log");
                log.Categories.Add("Debug");
                Logger.Write(log);
            }
            catch (Exception ex)
            {
                NotifyLoggingFailure(ex);
            }
        }
Example #2
0
 public void Error(ErrorMessageResID resID, LogSource source, Exception exp)
 {
     LogError(resID, source.ToString(), exp);
 }
Example #3
0
 public void Error(ErrorMessageResID resID, Exception exp)
 {
     LogError(resID, string.Empty, exp);
 }
Example #4
0
 public void Error(ErrorMessageResID resID, LogSource source)
 {
     LogError(resID, source.ToString(), null);
 }
Example #5
0
 public void Error(ErrorMessageResID resID, params object[] args)
 {
     LogError(resID, string.Empty, null, args);
 }
Example #6
0
 public void Error(ErrorMessageResID resID)
 {
     LogError(resID, string.Empty, null);
 }
 /// <summary>
 /// Referenced to GetErrorMessageInstance in the non-static method
 /// </summary>
 /// <param name="errorMessageID"></param>
 /// <returns></returns>
 public static string GetErrorMessage(ErrorMessageResID errorMessageID)
 {
     return(resourceManager.GetErrorMessageInstance(errorMessageID));
 }
 /// <summary>
 /// Get Error message based on the param
 /// </summary>
 /// <param name="resValue"></param>
 /// <returns></returns>
 public string GetErrorMessageInstance(ErrorMessageResID resValue)
 {
     return(cache.GetErrorMessage(APConvert.ToString(resValue.GetHashCode())));
 }