コード例 #1
0
        protected override void Starting(NuGetService instance)
        {
            foreach (var source in instance.GetEventSources())
            {
                EventListener.EnableEvents(source, EventLevel.Informational);
            }

            base.Starting(instance);

            foreach (var eventSource in instance.GetEventSources())
            {
                EventListener.EnableEvents(eventSource, EventLevel.LogAlways);
            }
        }
コード例 #2
0
        private void InitializeServiceLogging(NuGetService instance)
        {
            // Start logging this service's events to azure storage
            var serviceEventStream = new ObservableEventListener();

            foreach (var source in instance.GetEventSources())
            {
                serviceEventStream.EnableEvents(source, TraceLevel);
            }

            var mergedEvents = Observable.Merge(
                serviceEventStream,
                _platformEventStream.Where(evt => Equals(ServiceName.GetCurrent(), instance.ServiceName)));

            mergedEvents.LogToWindowsAzureTable(
                instanceName: instance.ServiceName.ToString(),
                connectionString: Config.Storage.Primary.GetConnectionString(),
                tableAddress: "NG" + instance.ServiceName.Name + "Trace");

            // Trace Http Requests
            var httpEventStream = new ObservableEventListener();

            httpEventStream.EnableEvents(HttpTraceEventSource.Log, EventLevel.LogAlways);
            httpEventStream
            .Where(e => Equals(ServiceName.GetCurrent(), instance.ServiceName))
            .LogToWindowsAzureTable(
                instanceName: instance.ServiceName.ToString(),
                connectionString: Config.Storage.Primary.GetConnectionString(),
                tableAddress: "NG" + instance.ServiceName.Name + "Http");
        }