style(Tracing): Cosmetic fixes for tracing.

This commit is contained in:
Eric Rozell 2016-07-15 18:53:35 -04:00
Родитель 46d171ce3e
Коммит 4ecede7e6d
4 изменённых файлов: 217 добавлений и 197 удалений

Просмотреть файл

@ -1,5 +1,4 @@
using System;
using Windows.Foundation.Diagnostics;
using Windows.Foundation.Diagnostics;
namespace ReactNative.Tracing
{

Просмотреть файл

@ -7,347 +7,367 @@ namespace ReactNative.Tracing
{
public static LoggingActivityBuilder With(this LoggingActivityBuilder builder, string name, Boolean value)
{
if (builder != null)
{
if (builder != null)
{
builder.Fields.AddBoolean(name, value);
}
return builder;
return builder;
}
public static LoggingActivityBuilder With(this LoggingActivityBuilder builder, string name, Boolean[] value)
public static LoggingActivityBuilder With(this LoggingActivityBuilder builder, string name, Boolean[] value)
{
if (builder != null)
{
if (builder != null)
{
builder.Fields.AddBooleanArray(name, value);
}
}
return builder;
return builder;
}
public static LoggingActivityBuilder With(this LoggingActivityBuilder builder, string name, Double value)
{
if (builder != null)
{
if (builder != null)
{
builder.Fields.AddDouble(name, value);
}
return builder;
return builder;
}
public static LoggingActivityBuilder With(this LoggingActivityBuilder builder, string name, Double[] value)
public static LoggingActivityBuilder With(this LoggingActivityBuilder builder, string name, Double[] value)
{
if (builder != null)
{
if (builder != null)
{
builder.Fields.AddDoubleArray(name, value);
}
}
return builder;
return builder;
}
public static LoggingActivityBuilder With(this LoggingActivityBuilder builder, string name, Guid value)
{
if (builder != null)
{
if (builder != null)
{
builder.Fields.AddGuid(name, value);
}
return builder;
return builder;
}
public static LoggingActivityBuilder With(this LoggingActivityBuilder builder, string name, Guid[] value)
public static LoggingActivityBuilder With(this LoggingActivityBuilder builder, string name, Guid[] value)
{
if (builder != null)
{
if (builder != null)
{
builder.Fields.AddGuidArray(name, value);
}
}
return builder;
return builder;
}
public static LoggingActivityBuilder With(this LoggingActivityBuilder builder, string name, Int16 value)
{
if (builder != null)
{
if (builder != null)
{
builder.Fields.AddInt16(name, value);
}
return builder;
return builder;
}
public static LoggingActivityBuilder With(this LoggingActivityBuilder builder, string name, Int16[] value)
public static LoggingActivityBuilder With(this LoggingActivityBuilder builder, string name, Int16[] value)
{
if (builder != null)
{
if (builder != null)
{
builder.Fields.AddInt16Array(name, value);
}
}
return builder;
return builder;
}
public static LoggingActivityBuilder With(this LoggingActivityBuilder builder, string name, Int32 value)
{
if (builder != null)
{
if (builder != null)
{
builder.Fields.AddInt32(name, value);
}
return builder;
return builder;
}
public static LoggingActivityBuilder With(this LoggingActivityBuilder builder, string name, Int32[] value)
public static LoggingActivityBuilder With(this LoggingActivityBuilder builder, string name, Int32[] value)
{
if (builder != null)
{
if (builder != null)
{
builder.Fields.AddInt32Array(name, value);
}
}
return builder;
return builder;
}
public static LoggingActivityBuilder With(this LoggingActivityBuilder builder, string name, Int64 value)
{
if (builder != null)
{
if (builder != null)
{
builder.Fields.AddInt64(name, value);
}
return builder;
return builder;
}
public static LoggingActivityBuilder With(this LoggingActivityBuilder builder, string name, Int64[] value)
public static LoggingActivityBuilder With(this LoggingActivityBuilder builder, string name, Int64[] value)
{
if (builder != null)
{
if (builder != null)
{
builder.Fields.AddInt64Array(name, value);
}
}
return builder;
return builder;
}
public static LoggingActivityBuilder With(this LoggingActivityBuilder builder, string name, Single value)
{
if (builder != null)
{
if (builder != null)
{
builder.Fields.AddSingle(name, value);
}
return builder;
return builder;
}
public static LoggingActivityBuilder With(this LoggingActivityBuilder builder, string name, Single[] value)
public static LoggingActivityBuilder With(this LoggingActivityBuilder builder, string name, Single[] value)
{
if (builder != null)
{
if (builder != null)
{
builder.Fields.AddSingleArray(name, value);
}
}
return builder;
return builder;
}
public static LoggingActivityBuilder With(this LoggingActivityBuilder builder, string name, String value)
{
if (builder != null)
{
if (builder != null)
{
builder.Fields.AddString(name, value);
}
return builder;
return builder;
}
public static LoggingActivityBuilder With(this LoggingActivityBuilder builder, string name, String[] value)
public static LoggingActivityBuilder With(this LoggingActivityBuilder builder, string name, String[] value)
{
if (builder != null)
{
if (builder != null)
{
builder.Fields.AddStringArray(name, value);
}
}
return builder;
return builder;
}
public static LoggingActivityBuilder With(this LoggingActivityBuilder builder, string name, TimeSpan value)
{
if (builder != null)
{
if (builder != null)
{
builder.Fields.AddTimeSpan(name, value);
}
return builder;
return builder;
}
public static LoggingActivityBuilder With(this LoggingActivityBuilder builder, string name, TimeSpan[] value)
public static LoggingActivityBuilder With(this LoggingActivityBuilder builder, string name, TimeSpan[] value)
{
if (builder != null)
{
if (builder != null)
{
builder.Fields.AddTimeSpanArray(name, value);
}
}
return builder;
return builder;
}
public static LoggingActivityBuilder With(this LoggingActivityBuilder builder, string name, UInt16 value)
{
if (builder != null)
{
if (builder != null)
{
builder.Fields.AddUInt16(name, value);
}
return builder;
return builder;
}
public static LoggingActivityBuilder With(this LoggingActivityBuilder builder, string name, UInt16[] value)
public static LoggingActivityBuilder With(this LoggingActivityBuilder builder, string name, UInt16[] value)
{
if (builder != null)
{
if (builder != null)
{
builder.Fields.AddUInt16Array(name, value);
}
}
return builder;
return builder;
}
public static LoggingActivityBuilder With(this LoggingActivityBuilder builder, string name, UInt32 value)
{
if (builder != null)
{
if (builder != null)
{
builder.Fields.AddUInt32(name, value);
}
return builder;
return builder;
}
public static LoggingActivityBuilder With(this LoggingActivityBuilder builder, string name, UInt32[] value)
public static LoggingActivityBuilder With(this LoggingActivityBuilder builder, string name, UInt32[] value)
{
if (builder != null)
{
if (builder != null)
{
builder.Fields.AddUInt32Array(name, value);
}
}
return builder;
return builder;
}
public static LoggingActivityBuilder With(this LoggingActivityBuilder builder, string name, UInt64 value)
{
if (builder != null)
{
if (builder != null)
{
builder.Fields.AddUInt64(name, value);
}
return builder;
return builder;
}
public static LoggingActivityBuilder With(this LoggingActivityBuilder builder, string name, UInt64[] value)
public static LoggingActivityBuilder With(this LoggingActivityBuilder builder, string name, UInt64[] value)
{
if (builder != null)
{
if (builder != null)
{
builder.Fields.AddUInt64Array(name, value);
}
}
return builder;
return builder;
}
public static LoggingActivityBuilder With(this LoggingActivityBuilder builder, string name, Byte value)
{
if (builder != null)
{
builder.Fields.AddUInt8(name, value);
}
return builder;
}
public static LoggingActivityBuilder With(this LoggingActivityBuilder builder, string name, Byte[] value)
{
if (builder != null)
{
builder.Fields.AddUInt8Array(name, value);
}
return builder;
}
public static LoggingActivityBuilder With(this LoggingActivityBuilder builder, string name, Char value)
{
if (builder != null)
{
builder.Fields.AddChar16(name, value);
}
if (builder != null)
{
builder.Fields.AddChar16(name, value);
}
return builder;
return builder;
}
public static LoggingActivityBuilder With(this LoggingActivityBuilder builder, string name, Char[] value)
public static LoggingActivityBuilder With(this LoggingActivityBuilder builder, string name, Char[] value)
{
if (builder != null)
{
builder.Fields.AddChar16Array(name, value);
}
if (builder != null)
{
builder.Fields.AddChar16Array(name, value);
}
return builder;
return builder;
}
public static LoggingActivityBuilder With(this LoggingActivityBuilder builder, string name, DateTimeOffset value)
{
if (builder != null)
{
builder.Fields.AddDateTime(name, value);
}
if (builder != null)
{
builder.Fields.AddDateTime(name, value);
}
return builder;
return builder;
}
public static LoggingActivityBuilder With(this LoggingActivityBuilder builder, string name, DateTimeOffset[] value)
public static LoggingActivityBuilder With(this LoggingActivityBuilder builder, string name, DateTimeOffset[] value)
{
if (builder != null)
{
builder.Fields.AddDateTimeArray(name, value);
}
if (builder != null)
{
builder.Fields.AddDateTimeArray(name, value);
}
return builder;
return builder;
}
public static LoggingActivityBuilder With(this LoggingActivityBuilder builder, string name, Rect value)
{
if (builder != null)
{
builder.Fields.AddRect(name, value);
}
if (builder != null)
{
builder.Fields.AddRect(name, value);
}
return builder;
return builder;
}
public static LoggingActivityBuilder With(this LoggingActivityBuilder builder, string name, Rect[] value)
public static LoggingActivityBuilder With(this LoggingActivityBuilder builder, string name, Rect[] value)
{
if (builder != null)
{
builder.Fields.AddRectArray(name, value);
}
if (builder != null)
{
builder.Fields.AddRectArray(name, value);
}
return builder;
return builder;
}
public static LoggingActivityBuilder With(this LoggingActivityBuilder builder, string name, Point value)
{
if (builder != null)
{
builder.Fields.AddPoint(name, value);
}
if (builder != null)
{
builder.Fields.AddPoint(name, value);
}
return builder;
return builder;
}
public static LoggingActivityBuilder With(this LoggingActivityBuilder builder, string name, Point[] value)
public static LoggingActivityBuilder With(this LoggingActivityBuilder builder, string name, Point[] value)
{
if (builder != null)
{
builder.Fields.AddPointArray(name, value);
}
if (builder != null)
{
builder.Fields.AddPointArray(name, value);
}
return builder;
return builder;
}
public static LoggingActivityBuilder With(this LoggingActivityBuilder builder, string name, Size value)
{
if (builder != null)
{
builder.Fields.AddSize(name, value);
}
if (builder != null)
{
builder.Fields.AddSize(name, value);
}
return builder;
return builder;
}
public static LoggingActivityBuilder With(this LoggingActivityBuilder builder, string name, Size[] value)
public static LoggingActivityBuilder With(this LoggingActivityBuilder builder, string name, Size[] value)
{
if (builder != null)
{
builder.Fields.AddSizeArray(name, value);
}
if (builder != null)
{
builder.Fields.AddSizeArray(name, value);
}
return builder;
return builder;
}
public static IDisposable Start(this LoggingActivityBuilder builder)
{
return builder?.Create();
}
public static IDisposable Start(this LoggingActivityBuilder builder)
{
return builder?.Create();
}
}
}

Просмотреть файл

@ -23,15 +23,16 @@ var types = new[]
var mappings = new Dictionary<Type, string>
{
{ typeof(char), "Char16" },
{ typeof(DateTimeOffset), "DateTime" },
{ typeof(byte), "UInt8" },
{ typeof(char), "Char16" },
{ typeof(DateTimeOffset), "DateTime" },
};
var others = new[]
{
"Rect",
"Point",
"Size",
"Rect",
"Point",
"Size",
};
#>
@ -48,22 +49,22 @@ foreach (var type in types)
#>
public static LoggingActivityBuilder With(this LoggingActivityBuilder builder, string name, <#=type.Name#> value)
{
if (builder != null)
{
if (builder != null)
{
builder.Fields.Add<#=type.Name#>(name, value);
}
return builder;
return builder;
}
public static LoggingActivityBuilder With(this LoggingActivityBuilder builder, string name, <#=type.Name#>[] value)
public static LoggingActivityBuilder With(this LoggingActivityBuilder builder, string name, <#=type.Name#>[] value)
{
if (builder != null)
{
if (builder != null)
{
builder.Fields.Add<#=type.Name#>Array(name, value);
}
}
return builder;
return builder;
}
<#
@ -75,22 +76,22 @@ foreach (var mapping in mappings)
#>
public static LoggingActivityBuilder With(this LoggingActivityBuilder builder, string name, <#=mapping.Key.Name#> value)
{
if (builder != null)
{
builder.Fields.Add<#=mapping.Value#>(name, value);
}
if (builder != null)
{
builder.Fields.Add<#=mapping.Value#>(name, value);
}
return builder;
return builder;
}
public static LoggingActivityBuilder With(this LoggingActivityBuilder builder, string name, <#=mapping.Key.Name#>[] value)
public static LoggingActivityBuilder With(this LoggingActivityBuilder builder, string name, <#=mapping.Key.Name#>[] value)
{
if (builder != null)
{
builder.Fields.Add<#=mapping.Value#>Array(name, value);
}
if (builder != null)
{
builder.Fields.Add<#=mapping.Value#>Array(name, value);
}
return builder;
return builder;
}
<#
@ -102,30 +103,30 @@ foreach (var other in others)
#>
public static LoggingActivityBuilder With(this LoggingActivityBuilder builder, string name, <#=other#> value)
{
if (builder != null)
{
builder.Fields.Add<#=other#>(name, value);
}
if (builder != null)
{
builder.Fields.Add<#=other#>(name, value);
}
return builder;
return builder;
}
public static LoggingActivityBuilder With(this LoggingActivityBuilder builder, string name, <#=other#>[] value)
public static LoggingActivityBuilder With(this LoggingActivityBuilder builder, string name, <#=other#>[] value)
{
if (builder != null)
{
builder.Fields.Add<#=other#>Array(name, value);
}
if (builder != null)
{
builder.Fields.Add<#=other#>Array(name, value);
}
return builder;
return builder;
}
<#
}
#>
public static IDisposable Start(this LoggingActivityBuilder builder)
{
return builder?.Create();
}
public static IDisposable Start(this LoggingActivityBuilder builder)
{
return builder?.Create();
}
}
}

Просмотреть файл

@ -8,7 +8,7 @@ namespace ReactNative.Tracing
/// </summary>
static class Tracer
{
/// <summary>
/// <summary>
/// Trace ID for bridge events.
/// </summary>
public const int TRACE_TAG_REACT_BRIDGE = 0;