private static void BeginApplication() { // initialize trace services TraceManagementService = new DefaultTraceManagementService(); TraceService = new DefaultTraceService(TraceManagementService); // add tracers (e.g. console tracer) TraceManagementService.AddTracer(new ConsoleTracer()); // configure tracing (e.g. trace all kind of messages) TraceManagementService.Categories = TraceCategories.All; }
/// <summary> /// Creates a new instance of the default trace service with given options /// </summary> /// <param name="managementService">Management service</param> /// <param name="options">Options to use for this trace service</param> public DefaultTraceService(ITraceManagementService managementService, TraceOptions options) { this.ManagementService = managementService ?? throw new ArgumentNullException(nameof(managementService)); this.Options = options ?? throw new ArgumentNullException(nameof(options)); this.IndentLevel = 0; this.IsEnded = false; this.Messages = new Queue <Message>(); this.Serializer = new PlainTextTraceObjectSerializer(this.Options); this.Timestamps = new Stack <DateTime>(); this.ProcessMessagesStopEvent = new ManualResetEvent(false); this.MessageWorker = StartMessageWorker(); }
/// <summary> /// Creates a new instance of the default trace service /// </summary> /// <param name="managementService">Management service</param> public DefaultTraceService(ITraceManagementService managementService) : this(managementService, new TraceOptions()) { // not used }