/// <summary> /// Logs the API trace log. /// </summary> /// <param name="traceLog">The trace log.</param> private void InternalLogApiTraceLog(ApiTraceLog traceLog) { if (traceLog != null) { InternalWriteContent(traceLog.ApiTraceLogToString()); } }
/// <summary> /// Logs the API trace log asynchronous. /// </summary> /// <param name="traceLog">The trace log.</param> public void LogApiTraceLog(ApiTraceLog traceLog) { if (traceLog != null) { Task.Factory.StartNew(() => InternalLogApiTraceLog(traceLog)); } }
/// <summary> /// Logs the API trace log asynchronous. /// </summary> /// <param name="traceLog">The trace log.</param> public void LogApiTraceLog(ApiTraceLog traceLog) { if (traceLog != null) { Console.WriteLine(format, DateTime.Now.ToFullDateTimeString(), traceLog.ToJson()); } }
/// <summary> /// APIs the trace log to string. /// </summary> /// <param name="log">The log.</param> /// <returns>System.String.</returns> public static string ApiTraceLogToString(this ApiTraceLog log) { StringBuilder builder = new StringBuilder(); if (log != null) { builder.AppendLineWithFormat("Trace ID: {0}", log.TraceId); ApiTraceLogToString(builder, log, 0); } return(builder.ToString()); }
/// <summary> /// Initializes the specified trace identifier. /// </summary> /// <param name="traceId">The trace identifier.</param> /// <param name="traceSequence">The trace sequence.</param> /// <param name="entryStamp">The entry stamp.</param> /// <param name="methodName">Name of the method.</param> public static void Initialize(string traceId, int?traceSequence, DateTime?entryStamp = null, [CallerMemberName] string methodName = null) { if (!string.IsNullOrWhiteSpace(traceId)) { if (!entryStamp.HasValue) { entryStamp = DateTime.UtcNow; } _root = new ApiTraceLog() { TraceId = traceId, TraceSequence = traceSequence.HasValue ? (traceSequence.Value + 1) : 0, EntryStamp = entryStamp }; var current = new ApiTraceStep(_root, methodName, entryStamp); _root.InnerTraces.Add(current); _current = current; } }
public void LogApiTraceLog(ApiTraceLog traceLog) { //TODO }
/// <summary> /// Disposes this instance. /// </summary> public static void Dispose() { _current = null; _root = null; }