private void RaiseNeedContextInformation(NeedContextInformationEventArgs args) { if (NeedContextInformation != null) { NeedContextInformation(this, args); } }
private void WriteLineIf(bool condition, string text, TraceEventType traceEventType = TraceEventType.Information, Exception exception = null) { NeedContextInformationEventArgs args = new NeedContextInformationEventArgs(); RaiseNeedContextInformation(args); WriteLineIf(condition, args.ContextInformation, text, traceEventType, exception); }
private static void Tracing_NeedContextInformation(object sender, DevExpress.Persistent.Base.NeedContextInformationEventArgs e) { string user = string.IsNullOrEmpty(SecuritySystem.CurrentUserName) ? "Unknown" : SecuritySystem.CurrentUserName; string host = string.IsNullOrEmpty(HttpContext.Current.Request.UserHostAddress) ? "Unknown" : HttpContext.Current.Request.UserHostAddress; e.ContextInformation = string.Format("User = {0}, Host = {1}", user, host); }
private string CreateTraceText(string text) { string traceText = GetDateTimeStamp() + FieldDelimiter.ToString(); NeedContextInformationEventArgs args = new NeedContextInformationEventArgs(); RaiseNeedContextInformation(args); if (!string.IsNullOrEmpty(args.ContextInformation)) { traceText += args.ContextInformation + FieldDelimiter.ToString(); } return(traceText + text); }