Index: binary-improvements2/WebServer/src/WebAPI/APIs/Log.cs
===================================================================
--- binary-improvements2/WebServer/src/WebAPI/GetLog.cs	(revision 391)
+++ binary-improvements2/WebServer/src/WebAPI/APIs/Log.cs	(revision 402)
@@ -1,12 +1,22 @@
 using System.Collections.Generic;
-using AllocsFixes.JSON;
 using JetBrains.Annotations;
+using Utf8Json;
 
-namespace Webserver.WebAPI {
+namespace Webserver.WebAPI.APIs {
 	[UsedImplicitly]
-	public class GetLog : AbsWebAPI {
-		private const int MAX_COUNT = 1000;
+	public class Log : AbsRestApi {
+		private const int maxCount = 1000;
+
+		private static readonly byte[] jsonKeyEntries = JsonWriter.GetEncodedPropertyNameWithBeginObject ("entries");
+		private static readonly byte[] jsonKeyFirstLine = JsonWriter.GetEncodedPropertyNameWithPrefixValueSeparator ("firstLine");
+		private static readonly byte[] jsonKeyLastLine = JsonWriter.GetEncodedPropertyNameWithPrefixValueSeparator ("lastLine");
+
+		private static readonly byte[] jsonMsgKey = JsonWriter.GetEncodedPropertyNameWithBeginObject ("msg");
+		private static readonly byte[] jsonTypeKey = JsonWriter.GetEncodedPropertyNameWithPrefixValueSeparator ("type");
+		private static readonly byte[] jsonTraceKey = JsonWriter.GetEncodedPropertyNameWithPrefixValueSeparator ("trace");
+		private static readonly byte[] jsonIsotimeKey = JsonWriter.GetEncodedPropertyNameWithPrefixValueSeparator ("isotime");
+		private static readonly byte[] jsonUptimeKey = JsonWriter.GetEncodedPropertyNameWithPrefixValueSeparator ("uptime");
 		
-		public override void HandleRequest (RequestContext _context) {
+		protected override void HandleRestGet (RequestContext _context) {
 			if (_context.Request.QueryString ["count"] == null || !int.TryParse (_context.Request.QueryString ["count"], out int count)) {
 				count = 50;
@@ -17,10 +27,10 @@
 			}
 
-			if (count > MAX_COUNT) {
-				count = MAX_COUNT;
+			if (count > maxCount) {
+				count = maxCount;
 			}
 
-			if (count < -MAX_COUNT) {
-				count = -MAX_COUNT;
+			if (count < -maxCount) {
+				count = -maxCount;
 			}
 
@@ -28,25 +38,49 @@
 				firstLine = count > 0 ? LogBuffer.Instance.OldestLine : LogBuffer.Instance.LatestLine;
 			}
-
-			JsonObject result = new JsonObject ();
-
+			
+			PrepareEnvelopedResult (out JsonWriter writer);
+			
+			writer.WriteRaw (jsonKeyEntries);
+			
 			List<LogBuffer.LogEntry> logEntries = LogBuffer.Instance.GetRange (ref firstLine, count, out int lastLine);
 
-			JsonArray entries = new JsonArray ();
+			writer.WriteBeginArray ();
+
+			bool first = true;
 			foreach (LogBuffer.LogEntry logEntry in logEntries) {
-				JsonObject entry = new JsonObject ();
-				entry.Add ("isotime", new JsonString (logEntry.isoTime));
-				entry.Add ("uptime", new JsonString (logEntry.uptime.ToString ()));
-				entry.Add ("msg", new JsonString (logEntry.message));
-				entry.Add ("trace", new JsonString (logEntry.trace));
-				entry.Add ("type", new JsonString (logEntry.type.ToStringCached ()));
-				entries.Add (entry);
+				if (!first) {
+					writer.WriteValueSeparator ();
+				}
+
+				first = false;
+				
+				writer.WriteRaw (jsonMsgKey);
+				writer.WriteString (logEntry.message);
+				
+				writer.WriteRaw (jsonTypeKey);
+				writer.WriteString (logEntry.type.ToStringCached ());
+				
+				writer.WriteRaw (jsonTraceKey);
+				writer.WriteString (logEntry.trace);
+				
+				writer.WriteRaw (jsonIsotimeKey);
+				writer.WriteString (logEntry.isoTime);
+				
+				writer.WriteRaw (jsonUptimeKey);
+				writer.WriteString (logEntry.uptime.ToString ());
+				
+				writer.WriteEndObject ();
 			}
+			writer.WriteEndArray ();
 
-			result.Add ("firstLine", new JsonNumber (firstLine));
-			result.Add ("lastLine", new JsonNumber (lastLine));
-			result.Add ("entries", entries);
+			writer.WriteRaw (jsonKeyFirstLine);
+			writer.WriteInt32 (firstLine);
+			
+			writer.WriteRaw (jsonKeyLastLine);
+			writer.WriteInt32 (lastLine);
+			
+			writer.WriteEndObject ();
 
-			WebUtils.WriteJson (_context.Response, result);
+			SendEnvelopedResult (_context, ref writer);
 		}
 	}
