Example #1
0
        protected void Logging(string message, LogType en)
        {
            try
            {
                try
                {
                    if (String.IsNullOrEmpty(MethodName))
                    {
                        MethodName = string.Format("{0}", new System.Diagnostics.StackTrace().GetFrame(1).GetMethod().Name);
                    }
                }
                catch (Exception ex)
                {
                    LogSystem.Error(ex);
                }
                string threadInfo = GetThreadId();
                message = new StringBuilder().Append("- ClassName: ").Append(ClassName)
                          .Append("\n- MethodName: ").Append(MethodName).
                          Append("\n- UserName: "******"\n- ThreadInfo: ").Append(threadInfo)
                          .Append(message).ToString();
                switch (en)
                {
                case LogType.Debug:
                    LogSystem.Debug(message);
                    break;

                case LogType.Info:
                    LogSystem.Info(message);
                    break;

                case LogType.Warn:
                    LogSystem.Warn(message);
                    break;

                case LogType.Error:
                    LogSystem.Error(message);
                    break;

                case LogType.Fatal:
                    LogSystem.Fatal(message);
                    break;

                default:
                    break;
                }
            }
            catch (Exception ex)
            {
                try
                {
                    LogSystem.Error("EntityBase.Logging.Exception.", ex);
                }
                catch (Exception)
                {
                }
            }
        }
Example #2
0
        protected void Logging(string message, LogType en)
        {
            try
            {
                string threadInfo = GetThreadId();
                message = new StringBuilder().Append("- RequestUrl: ").Append(RequestUrl)
                          .Append("\n- UserName: "******"\n- ThreadInfo: ").Append(threadInfo)
                          .Append(message).ToString();
                switch (en)
                {
                case LogType.Debug:
                    LogSystem.Debug(message);
                    break;

                case LogType.Info:
                    LogSystem.Info(message);
                    break;

                case LogType.Warn:
                    LogSystem.Warn(message);
                    break;

                case LogType.Error:
                    LogSystem.Error(message);
                    break;

                case LogType.Fatal:
                    LogSystem.Fatal(message);
                    break;

                default:
                    break;
                }
            }
            catch (Exception ex)
            {
                LogSystem.Error("AdapterBase.Logging.Exception.", ex);
            }
        }