public override void Visit(CosmosDiagnosticScope cosmosDiagnosticScope)
        {
            this.jsonWriter.WriteStartObject();

            this.jsonWriter.WritePropertyName("Id");
            this.jsonWriter.WriteValue(cosmosDiagnosticScope.Id);

            this.jsonWriter.WritePropertyName("ElapsedTime");
            if (cosmosDiagnosticScope.TryGetElapsedTime(out TimeSpan elapsedTime))
            {
                this.jsonWriter.WriteValue(elapsedTime);
            }
            else
            {
                this.jsonWriter.WriteValue("Timer Never Stopped.");
            }

            this.jsonWriter.WriteEndObject();
        }
예제 #2
0
        public override void Visit(CosmosDiagnosticScope cosmosDiagnosticScope)
        {
            this.jsonWriter.WriteStartObject();

            this.jsonWriter.WritePropertyName("Id");
            this.jsonWriter.WriteValue(cosmosDiagnosticScope.Id);

            if (cosmosDiagnosticScope.IsComplete())
            {
                this.jsonWriter.WritePropertyName("ElapsedTimeInMs");
            }
            else
            {
                this.jsonWriter.WritePropertyName("RunningElapsedTimeInMs");
            }

            this.jsonWriter.WriteValue(cosmosDiagnosticScope.GetElapsedTime().TotalMilliseconds);

            this.jsonWriter.WriteEndObject();
        }