Пример #1
0
        private SortedList OnDefaultWriteTrace(TraceObject traceObj)
        {
            SortedList  parameters = new SortedList();
            HttpContext context    = HttpContext.Current;

            if (context != null)
            {
                parameters.Add("RequestType", context.Request.RequestType);
                parameters.Add("HttpMethod", context.Request.HttpMethod);
                parameters.Add("Url", DataConvert.ToString(context.Request.Url));
                parameters.Add("UrlReferrer", DataConvert.ToString(context.Request.UrlReferrer));
                parameters.Add("LogonUser", context.Request.LogonUserIdentity.Name);
                parameters.Add("QueryString", context.Request.QueryString.ToString());
                parameters.Add("Form", context.Request.Form.ToString());
                NameValueCollection cookies = new NameValueCollection();
                for (int i = 0; i < context.Request.Cookies.Count; i++)
                {
                    HttpCookie cookie = context.Request.Cookies[i];
                    cookies.Add(cookie.Name, cookie.Value);
                }
                parameters.Add("Cookies", cookies.ToString());
                if (context.Items.Contains("TraceContext"))
                {
                    parameters.Add("TraceContext", context.Items["TraceContext"]);
                }
            }
            parameters.Add("TraceObject", traceObj);
            return(parameters);
        }
Пример #2
0
 public void Write(TraceObject traceData)
 {
     if (this.OnWriteTrace != null)
     {
         this.TracerProxy.Process(this.OnWriteTrace(traceData));
     }
 }
Пример #3
0
        public void Write(string traceClass, string traceMethod, string message)
        {
            TraceObject traceObj = new TraceObject(traceClass, traceMethod, message)
            {
                Level = TraceLevel.Info
            };

            this.Write(traceObj);
        }
Пример #4
0
        public void Write(string traceClass, string traceMethod, Exception ex, int errorCode)
        {
            TraceObject traceObj;

            if (errorCode > -2147483648)
            {
                traceObj = new TraceObject(traceClass, traceMethod, "Trace exception", ex.ToString());
            }
            else
            {
                traceObj = new TraceObject(traceClass, traceMethod, "Trace exception", string.Concat(new object[] { "ErrorCode=", errorCode, ":", ex.ToString() }));
            }
            traceObj.Level = TraceLevel.Error;
            this.Write(traceObj);
        }
Пример #5
0
 private SortedList OnDefaultWriteTrace(TraceObject traceObj)
 {
     SortedList parameters = new SortedList();
     HttpContext context = HttpContext.Current;
     if (context != null)
     {
         parameters.Add("RequestType", context.Request.RequestType);
         parameters.Add("HttpMethod", context.Request.HttpMethod);
         parameters.Add("Url", DataConvert.ToString(context.Request.Url));
         parameters.Add("UrlReferrer", DataConvert.ToString(context.Request.UrlReferrer));
         parameters.Add("LogonUser", context.Request.LogonUserIdentity.Name);
         parameters.Add("QueryString", context.Request.QueryString.ToString());
         parameters.Add("Form", context.Request.Form.ToString());
         NameValueCollection cookies = new NameValueCollection();
         for (int i = 0; i < context.Request.Cookies.Count; i++)
         {
             HttpCookie cookie = context.Request.Cookies[i];
             cookies.Add(cookie.Name, cookie.Value);
         }
         parameters.Add("Cookies", cookies.ToString());
         if (context.Items.Contains("TraceContext"))
         {
             parameters.Add("TraceContext", context.Items["TraceContext"]);
         }
     }
     parameters.Add("TraceObject", traceObj);
     return parameters;
 }
Пример #6
0
 public void Write(string traceClass, string traceMethod, Exception ex, int errorCode)
 {
     TraceObject traceObj;
     if (errorCode > -2147483648)
     {
         traceObj = new TraceObject(traceClass, traceMethod, "Trace exception", ex.ToString());
     }
     else
     {
         traceObj = new TraceObject(traceClass, traceMethod, "Trace exception", string.Concat(new object[] { "ErrorCode=", errorCode, ":", ex.ToString() }));
     }
     traceObj.Level = TraceLevel.Error;
     this.Write(traceObj);
 }
Пример #7
0
 public void Write(string traceClass, string traceMethod, string message)
 {
     TraceObject traceObj = new TraceObject(traceClass, traceMethod, message) {
         Level = TraceLevel.Info
     };
     this.Write(traceObj);
 }
Пример #8
0
 public void Write(TraceObject traceData)
 {
     if (this.OnWriteTrace != null)
     {
         this.TracerProxy.Process(this.OnWriteTrace(traceData));
     }
 }