private static void EmitLogs() { IfxTracer.LogMessage( IfxTracingLevel.Critical, // The trace level of this trace message. "ComponentFoo", // Tag Id: This parameter can be used for identifying and grouping the source of the instrumentation point. e.g. at component, class or file level. // You can potentially use the value of this value to retrieve message emitted from particular parts of the source code in log search. "A critical message."); // The message being logged. }
/// <summary> /// Writes trace information, a formatted array of objects and event information to <c>Ifx</c>. /// </summary> /// <param name="eventCache">A <see cref="TraceEventCache"/> object that contains the current process ID, thread ID and stack trace information</param> /// <param name="source">Name used to identify the source of the event</param> /// <param name="eventType">One of the <see cref="TraceEventType"/> values specifying the type of event that has caused the trace</param> /// <param name="id">A numeric identifier for the event</param> /// <param name="format">A format string that contains zero or more format items, which correspond to objects in the args array</param> /// <param name="args">An object array containing zero or more objects to format</param> public override void TraceEvent(TraceEventCache eventCache, string source, TraceEventType eventType, int id, string format, params object[] args) { var tracingLevel = GetIfxTracingLevel(eventType); IfxTracer.LogMessage( tracingLevel, source, string.Format(format, args)); }
/// <summary> /// This sample illustrates how to use the Ifx tracing APIs. /// </summary> public static void TracingSample() { /* * Tracing a log message. */ IfxTracer.LogMessage( IfxTracingLevel.Critical, // The trace level of this trace message. "C8A640DD-F25E-4CA1-9265-1AC2628D0190", // Tag Id: The unique identification of the instrumentation point in the source code. "A critical message."); // The message being logged. /* * Logging property bag. */ IfxTracer.LogPropertyBag( IfxTracingLevel.Critical, // The trace level of this trace message. "343A9FA7-B2D5-43FD-8D27-99AE108FA988", // Tag Id: The unique identification of the instrumentation point in the source code. "Pet", // Property 1 "Cat", // Value 1 "Sound", // Property 2 "Meow, meow"); // Value 2 }