public ChoProfile(bool condition, string msg, ChoProfile outerProfile) { _condition = condition; if (outerProfile != null) { _indent = outerProfile._indent + 1; } if (String.IsNullOrEmpty(msg)) { msg = GetDefaultMsg(ChoStackTrace.GetStackFrame()); } if (_condition) { if (ChoTraceSettings.Me.IndentProfiling) { ChoTrace.WriteLineIf(_condition, ChoStackTrace.GetStackFrame(typeof(ChoProfile)), String.Format("{0} {{", msg).Indent(_indent)); } else { ChoTrace.WriteLineIf(_condition, ChoStackTrace.GetStackFrame(typeof(ChoProfile)), String.Format("{0} {{", msg)); } } //if (outerProfile is ChoProfileContainer) // ((ChoProfileContainer)outerProfile).Add(this); }
protected override void Dispose(bool finalize) { if (!IsDisposed) { IsDisposed = true; Clear(); if (_condition) { if (ChoTraceSettings.Me.IndentProfiling) { ChoTrace.WriteLineIf(_condition, ChoStackTrace.GetStackFrame(typeof(ChoProfile)), String.Format("}} [{0}] <---", Convert.ToString(DateTime.Now - _startTime)).Indent(_indent)); } else { ChoTrace.WriteLineIf(_condition, ChoStackTrace.GetStackFrame(typeof(ChoProfile)), String.Format("}} [{0}] <---", Convert.ToString(DateTime.Now - _startTime))); } } if (!finalize) { GC.SuppressFinalize(this); } } }
private void _WriteLineIf(bool condition, string msg) { if (ChoTraceSettings.Me.IndentProfiling) { msg = msg.Indent(_indent + 1); } ChoTrace.WriteLineIf(condition, ChoStackTrace.GetStackFrame(typeof(ChoProfile)), msg); }
public static void WriteNewLineIf(bool condition) { IChoProfile profile = GetDefaultContext(new StackFrame(1)); if (profile != null) { profile.AppendIf(condition, Environment.NewLine); } else { ChoTrace.WriteLineIf(condition, Environment.NewLine); } }
public static void WriteSeparatorIf(bool condition) { IChoProfile profile = GetDefaultContext(new StackFrame(1)); if (profile != null) { profile.AppendLineIf(condition, ChoTrace.SEPARATOR); } else { ChoTrace.WriteLineIf(condition, ChoTrace.SEPARATOR); } }
public static void WriteLineIf(bool condition, string msg) { IChoProfile profile = GetDefaultContext(new StackFrame(1)); if (profile != null) { profile.AppendLineIf(condition, msg); } else { ChoTrace.WriteLineIf(condition, msg); } }
public static void WriteLineIf(bool condition, string format, params object[] args) { IChoProfile profile = GetDefaultContext(new StackFrame(1)); if (profile != null) { profile.AppendLineIf(condition, String.Format(format, args)); } else { ChoTrace.WriteLineIf(condition, String.Format(format, args)); } }
public ChoTrace(bool condition, string msg) { ChoTrace.WriteLineIf(condition, msg); }