/// <summary> /// Logs objects buffered in <paramref name="buffer"/>. /// Will only process objects from index 0 to <paramref name="length"/> [inclusive, exclusive) /// </summary> static void LogInternal(ObjectsBuffer buffer, int length) { Action <string> log = logActions[buffer.logType]; if (length == 0) //Handles degenerate input { log(""); return; } StringBuilderPooler pooler = builderPoolerLocal.Value; StringBuilder builder = pooler.GetObject(); for (int i = 0; i < length; i++) { builder.Append(ToString(buffer[i])); if (i + 1 != length) { builder.Append("; "); } } log(builder.ToString()); pooler.ReleaseObject(builder); }
public static void Log <T0>(DebugLogType type, T0 t0) { var buffer = new ObjectsBuffer(objectsBufferLocal.Value, type) { [0] = t0 }; LogInternal(buffer, 1); }
public static void Log <T0, T1>(DebugLogType type, T0 t0, T1 t1) { var buffer = new ObjectsBuffer(objectsBufferLocal.Value, type) { [0] = t0, [1] = t1 }; LogInternal(buffer, 2); }
public static void Log <T0, T1, T2>(DebugLogType type, T0 t0, T1 t1, T2 t2) { var buffer = new ObjectsBuffer(objectsBufferLocal.Value, type) { [0] = t0, [1] = t1, [2] = t2 }; LogInternal(buffer, 3); }
public ObjectsBuffer(ObjectsBuffer buffer, DebugLogType logType) : this(buffer.objects, logType) { }