Replace gl::trace logging with Chromium style logging

Removing one usage of FormatString() and its static buffer.
And preparation for Platform logging.

BUG=angleproject:1660

Change-Id: I58192988ad16196706fe48d0c0ab0fd1a10c0210
Reviewed-on: https://chromium-review.googlesource.com/424173
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Yuly Novikov <ynovikov@chromium.org>
diff --git a/src/libANGLE/renderer/d3d/HLSLCompiler.cpp b/src/libANGLE/renderer/d3d/HLSLCompiler.cpp
index 58746bc..3b4d638 100644
--- a/src/libANGLE/renderer/d3d/HLSLCompiler.cpp
+++ b/src/libANGLE/renderer/d3d/HLSLCompiler.cpp
@@ -136,7 +136,7 @@
 
     if (!mD3DCompilerModule)
     {
-        ERR("D3D compiler module not found.");
+        ERR() << "D3D compiler module not found.";
         return gl::Error(GL_OUT_OF_MEMORY, "D3D compiler module not found.");
     }
 
@@ -217,8 +217,8 @@
             SafeRelease(errorMessage);
 
             infoLog.appendSanitized(message.c_str());
-            TRACE("\n%s", hlsl.c_str());
-            TRACE("\n%s", message.c_str());
+            WARN() << std::endl << hlsl;
+            WARN() << std::endl << message;
 
             if ((message.find("error X3531:") != std::string::npos ||  // "can't unroll loops marked with loop attribute"
                  message.find("error X4014:") != std::string::npos) && // "cannot have gradient operations inside loops with divergent flow control",
diff --git a/src/libANGLE/renderer/d3d/ProgramD3D.cpp b/src/libANGLE/renderer/d3d/ProgramD3D.cpp
index b826bbc..85acde7 100644
--- a/src/libANGLE/renderer/d3d/ProgramD3D.cpp
+++ b/src/libANGLE/renderer/d3d/ProgramD3D.cpp
@@ -1188,9 +1188,8 @@
     }
     else if (!infoLog)
     {
-        std::vector<char> tempCharBuffer(tempInfoLog.getLength() + 3);
-        tempInfoLog.getLog(static_cast<GLsizei>(tempInfoLog.getLength()), NULL, &tempCharBuffer[0]);
-        ERR("Error compiling dynamic pixel executable:\n%s\n", &tempCharBuffer[0]);
+        ERR() << "Error compiling dynamic pixel executable:" << std::endl
+              << tempInfoLog.str() << std::endl;
     }
 
     *outExectuable = pixelExecutable;
@@ -1234,9 +1233,8 @@
     }
     else if (!infoLog)
     {
-        std::vector<char> tempCharBuffer(tempInfoLog.getLength() + 3);
-        tempInfoLog.getLog(static_cast<GLsizei>(tempInfoLog.getLength()), NULL, &tempCharBuffer[0]);
-        ERR("Error compiling dynamic vertex executable:\n%s\n", &tempCharBuffer[0]);
+        ERR() << "Error compiling dynamic vertex executable:" << std::endl
+              << tempInfoLog.str() << std::endl;
     }
 
     *outExectuable = vertexExecutable;
@@ -1285,9 +1283,8 @@
 
     if (!infoLog && error.isError())
     {
-        std::vector<char> tempCharBuffer(tempInfoLog.getLength() + 3);
-        tempInfoLog.getLog(static_cast<GLsizei>(tempInfoLog.getLength()), NULL, &tempCharBuffer[0]);
-        ERR("Error compiling dynamic geometry executable:\n%s\n", &tempCharBuffer[0]);
+        ERR() << "Error compiling dynamic geometry executable:" << std::endl
+              << tempInfoLog.str() << std::endl;
     }
 
     if (geometryExecutable != nullptr)
@@ -1454,9 +1451,8 @@
 
     if (computeExecutable == nullptr)
     {
-        std::vector<char> tempCharBuffer(infoLog.getLength() + 3);
-        infoLog.getLog(static_cast<GLsizei>(infoLog.getLength()), nullptr, &tempCharBuffer[0]);
-        ERR("Error compiling dynamic compute executable:\n%s\n", &tempCharBuffer[0]);
+        ERR() << "Error compiling dynamic compute executable:" << std::endl
+              << infoLog.str() << std::endl;
     }
     else
     {
diff --git a/src/libANGLE/renderer/d3d/RendererD3D.cpp b/src/libANGLE/renderer/d3d/RendererD3D.cpp
index 729d7c8..87efeb8 100644
--- a/src/libANGLE/renderer/d3d/RendererD3D.cpp
+++ b/src/libANGLE/renderer/d3d/RendererD3D.cpp
@@ -184,7 +184,7 @@
         {
             // This is stictly speaking not an error, but developers should be
             // notified of risking undefined behavior.
-            ERR("Point rendering without writing to gl_PointSize.");
+            ERR() << "Point rendering without writing to gl_PointSize.";
 
             return true;
         }
diff --git a/src/libANGLE/renderer/d3d/VertexDataManager.cpp b/src/libANGLE/renderer/d3d/VertexDataManager.cpp
index 89dd4fa..72329d7 100644
--- a/src/libANGLE/renderer/d3d/VertexDataManager.cpp
+++ b/src/libANGLE/renderer/d3d/VertexDataManager.cpp
@@ -85,7 +85,7 @@
         auto errorOrElementSize = factory->getVertexSpaceRequired(attrib, 1, 0);
         if (errorOrElementSize.isError())
         {
-            ERR("Unlogged error in DirectStoragePossible.");
+            ERR() << "Unlogged error in DirectStoragePossible.";
             return false;
         }
 
@@ -194,7 +194,7 @@
 
     if (!mStreamingBuffer)
     {
-        ERR("Failed to allocate the streaming vertex buffer.");
+        ERR() << "Failed to allocate the streaming vertex buffer.";
     }
 }
 
diff --git a/src/libANGLE/renderer/d3d/d3d11/Clear11.cpp b/src/libANGLE/renderer/d3d/d3d11/Clear11.cpp
index d106468..67ac491 100644
--- a/src/libANGLE/renderer/d3d/d3d11/Clear11.cpp
+++ b/src/libANGLE/renderer/d3d/d3d11/Clear11.cpp
@@ -286,11 +286,11 @@
                   formatInfo.componentType == GL_UNSIGNED_NORMALIZED ||
                   formatInfo.componentType == GL_SIGNED_NORMALIZED))
             {
-                ERR("It is undefined behaviour to clear a render buffer which is not normalized "
-                    "fixed point or floating-"
-                    "point to floating point values (color attachment %u has internal format "
-                    "0x%X).",
-                    colorAttachmentIndex, attachment.getFormat().asSized());
+                ERR() << "It is undefined behaviour to clear a render buffer which is not "
+                         "normalized fixed point or floating-point to floating point values (color "
+                         "attachment "
+                      << colorAttachmentIndex << " has internal format " << attachment.getFormat()
+                      << ").";
             }
 
             if ((formatInfo.redBits == 0 || !clearParams.colorMaskRed) &&
@@ -618,7 +618,7 @@
         HRESULT result               = device->CreateBlendState(&blendDesc, &blendState);
         if (FAILED(result) || !blendState)
         {
-            ERR("Unable to create a ID3D11BlendState, HRESULT: 0x%X.", result);
+            ERR() << "Unable to create a ID3D11BlendState, " << gl::FmtHR(result) << ".";
             return nullptr;
         }
 
@@ -664,7 +664,7 @@
         HRESULT result                   = device->CreateDepthStencilState(&dsDesc, &dsState);
         if (FAILED(result) || !dsState)
         {
-            ERR("Unable to create a ID3D11DepthStencilState, HRESULT: 0x%X.", result);
+            ERR() << "Unable to create a ID3D11DepthStencilState, " << gl::FmtHR(result) << ".";
             return nullptr;
         }
 
diff --git a/src/libANGLE/renderer/d3d/d3d11/InputLayoutCache.cpp b/src/libANGLE/renderer/d3d/d3d11/InputLayoutCache.cpp
index 89d5dc6..dcc0733 100644
--- a/src/libANGLE/renderer/d3d/d3d11/InputLayoutCache.cpp
+++ b/src/libANGLE/renderer/d3d/d3d11/InputLayoutCache.cpp
@@ -513,8 +513,8 @@
                                         &inputLayout));
             if (mLayoutMap.size() >= mCacheSize)
             {
-                TRACE("Overflowed the limit of %u input layouts, purging half the cache.",
-                      mCacheSize);
+                WARN() << "Overflowed the limit of " << mCacheSize
+                       << " input layouts, purging half the cache.";
 
                 // Randomly release every second element
                 auto it = mLayoutMap.begin();
diff --git a/src/libANGLE/renderer/d3d/d3d11/RenderStateCache.cpp b/src/libANGLE/renderer/d3d/d3d11/RenderStateCache.cpp
index 329cd5e..1d664b7 100644
--- a/src/libANGLE/renderer/d3d/d3d11/RenderStateCache.cpp
+++ b/src/libANGLE/renderer/d3d/d3d11/RenderStateCache.cpp
@@ -132,8 +132,8 @@
     {
         if (mBlendStateCache.size() >= kMaxBlendStates)
         {
-            TRACE("Overflowed the limit of %u blend states, removing the least recently used "
-                  "to make room.", kMaxBlendStates);
+            WARN() << "Overflowed the limit of " << kMaxBlendStates
+                   << " blend states, removing the least recently used to make room.";
 
             BlendStateMap::iterator leastRecentlyUsed = mBlendStateCache.begin();
             for (BlendStateMap::iterator i = mBlendStateCache.begin(); i != mBlendStateCache.end(); i++)
@@ -226,8 +226,8 @@
     {
         if (mRasterizerStateCache.size() >= kMaxRasterizerStates)
         {
-            TRACE("Overflowed the limit of %u rasterizer states, removing the least recently used "
-                  "to make room.", kMaxRasterizerStates);
+            WARN() << "Overflowed the limit of " << kMaxRasterizerStates
+                   << " rasterizer states, removing the least recently used to make room.";
 
             RasterizerStateMap::iterator leastRecentlyUsed = mRasterizerStateCache.begin();
             for (RasterizerStateMap::iterator i = mRasterizerStateCache.begin(); i != mRasterizerStateCache.end(); i++)
@@ -333,10 +333,8 @@
 
     if (mDepthStencilStateCache.size() >= kMaxDepthStencilStates)
     {
-        TRACE(
-            "Overflowed the limit of %u depth stencil states, removing the least recently used "
-            "to make room.",
-            kMaxDepthStencilStates);
+        WARN() << "Overflowed the limit of " << kMaxDepthStencilStates
+               << " depth stencil states, removing the least recently used to make room.";
 
         auto leastRecentlyUsed = mDepthStencilStateCache.begin();
         for (auto i = mDepthStencilStateCache.begin(); i != mDepthStencilStateCache.end(); i++)
@@ -414,8 +412,8 @@
     {
         if (mSamplerStateCache.size() >= kMaxSamplerStates)
         {
-            TRACE("Overflowed the limit of %u sampler states, removing the least recently used "
-                  "to make room.", kMaxSamplerStates);
+            WARN() << "Overflowed the limit of " << kMaxSamplerStates
+                   << " sampler states, removing the least recently used to make room.";
 
             SamplerStateMap::iterator leastRecentlyUsed = mSamplerStateCache.begin();
             for (SamplerStateMap::iterator i = mSamplerStateCache.begin(); i != mSamplerStateCache.end(); i++)
diff --git a/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp b/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp
index 8a20d4e..d36675d 100644
--- a/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp
+++ b/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp
@@ -9,7 +9,6 @@
 #include "libANGLE/renderer/d3d/d3d11/Renderer11.h"
 
 #include <EGL/eglext.h>
-#include <iomanip>
 #include <sstream>
 #include <versionhelpers.h>
 
@@ -733,7 +732,7 @@
 
         if (!mDevice || FAILED(result))
         {
-            ERR("Failed creating Debug D3D11 device - falling back to release runtime.\n");
+            ERR() << "Failed creating Debug D3D11 device - falling back to release runtime.";
         }
 
         if (!mDevice || FAILED(result))
@@ -869,7 +868,7 @@
     if (FAILED(hr))
     {
         mRenderer11DeviceCaps.driverVersion.reset();
-        ERR("Error querying driver version from DXGI Adapter.");
+        ERR() << "Error querying driver version from DXGI Adapter.";
     }
     else
     {
@@ -2651,7 +2650,7 @@
 
     if (isLost)
     {
-        ERR("The D3D11 device was removed: 0x%08X", result);
+        ERR() << "The D3D11 device was removed, " << gl::FmtHR(result);
     }
 
     return isLost;
@@ -2761,7 +2760,7 @@
 
     if (result.isError())
     {
-        ERR("Could not reinitialize D3D11 device: %08X", result.getCode());
+        ERR() << "Could not reinitialize D3D11 device: " << result;
         return false;
     }
 
diff --git a/src/libANGLE/renderer/d3d/d3d11/SwapChain11.cpp b/src/libANGLE/renderer/d3d/d3d11/SwapChain11.cpp
index a410c42..e9bcbf0 100644
--- a/src/libANGLE/renderer/d3d/d3d11/SwapChain11.cpp
+++ b/src/libANGLE/renderer/d3d/d3d11/SwapChain11.cpp
@@ -227,7 +227,7 @@
 
         if (FAILED(result))
         {
-            ERR("Could not create offscreen texture: %08lX", result);
+            ERR() << "Could not create offscreen texture, " << gl::FmtHR(result);
             release();
 
             if (d3d11::isDeviceLostError(result))
@@ -251,7 +251,7 @@
             // Fall back to no share handle on failure
             if (FAILED(result))
             {
-                ERR("Could not query offscreen texture resource: %08lX", result);
+                ERR() << "Could not query offscreen texture resource, " << gl::FmtHR(result);
             }
             else
             {
@@ -261,7 +261,7 @@
                 if (FAILED(result))
                 {
                     mShareHandle = NULL;
-                    ERR("Could not get offscreen texture shared handle: %08lX", result);
+                    ERR() << "Could not get offscreen texture shared handle, " << gl::FmtHR(result);
                 }
             }
         }
@@ -348,7 +348,8 @@
             device->CreateTexture2D(&depthStencilTextureDesc, NULL, &mDepthStencilTexture);
         if (FAILED(result))
         {
-            ERR("Could not create depthstencil surface for new swap chain: 0x%08X", result);
+            ERR() << "Could not create depthstencil surface for new swap chain, "
+                  << gl::FmtHR(result);
             release();
 
             if (d3d11::isDeviceLostError(result))
@@ -423,7 +424,7 @@
     HRESULT result = mSwapChain->GetDesc(&desc);
     if (FAILED(result))
     {
-        ERR("Error reading swap chain description: 0x%08X", result);
+        ERR() << "Error reading swap chain description, " << gl::FmtHR(result);
         release();
         return EGL_BAD_ALLOC;
     }
@@ -432,7 +433,7 @@
 
     if (FAILED(result))
     {
-        ERR("Error resizing swap chain buffers: 0x%08X", result);
+        ERR() << "Error resizing swap chain buffers, " << gl::FmtHR(result);
         release();
 
         if (d3d11::isDeviceLostError(result))
@@ -523,7 +524,8 @@
 
         if (FAILED(result))
         {
-            ERR("Could not create additional swap chains or offscreen surfaces: %08lX", result);
+            ERR() << "Could not create additional swap chains or offscreen surfaces, "
+                  << gl::FmtHR(result);
             release();
 
             if (d3d11::isDeviceLostError(result))
@@ -810,18 +812,18 @@
 
     if (result == DXGI_ERROR_DEVICE_REMOVED)
     {
-        ERR("Present failed: the D3D11 device was removed: 0x%08X",
-            mRenderer->getDevice()->GetDeviceRemovedReason());
+        ERR() << "Present failed: the D3D11 device was removed, "
+              << gl::FmtHR(mRenderer->getDevice()->GetDeviceRemovedReason());
         return EGL_CONTEXT_LOST;
     }
     else if (result == DXGI_ERROR_DEVICE_RESET)
     {
-        ERR("Present failed: the D3D11 device was reset from a bad command.");
+        ERR() << "Present failed: the D3D11 device was reset from a bad command.";
         return EGL_CONTEXT_LOST;
     }
     else if (FAILED(result))
     {
-        ERR("Present failed with error code 0x%08X", result);
+        ERR() << "Present failed with " << gl::FmtHR(result);
     }
 
     mNativeWindow->commitChange();
diff --git a/src/libANGLE/renderer/d3d/d3d11/TextureStorage11.cpp b/src/libANGLE/renderer/d3d/d3d11/TextureStorage11.cpp
index 8a4d79d..5d01dfc 100644
--- a/src/libANGLE/renderer/d3d/d3d11/TextureStorage11.cpp
+++ b/src/libANGLE/renderer/d3d/d3d11/TextureStorage11.cpp
@@ -790,7 +790,7 @@
                 if (error.isError())
                 {
                     // TODO: Find a way to report this back to the context
-                    ERR("Error initialization texture storage: %x", error.getCode());
+                    ERR() << "Error initialization texture storage: " << error;
                 }
             }
         }
diff --git a/src/libANGLE/renderer/d3d/d3d11/renderer11_utils.cpp b/src/libANGLE/renderer/d3d/d3d11/renderer11_utils.cpp
index 24c7fe2..fe0d6da 100644
--- a/src/libANGLE/renderer/d3d/d3d11/renderer11_utils.cpp
+++ b/src/libANGLE/renderer/d3d/d3d11/renderer11_utils.cpp
@@ -61,7 +61,7 @@
             else
             {
                 // TODO(jmadill): find out why we fail this call sometimes in FL9_3
-                // ERR("Error checking format support for format 0x%x", dxgiFormat);
+                // ERR() << "Error checking format support for format 0x" << std::hex << dxgiFormat;
             }
         }
 
diff --git a/src/libANGLE/renderer/d3d/d3d11/winrt/CoreWindowNativeWindow.cpp b/src/libANGLE/renderer/d3d/d3d11/winrt/CoreWindowNativeWindow.cpp
index 0211e68..36e4bd0 100644
--- a/src/libANGLE/renderer/d3d/d3d11/winrt/CoreWindowNativeWindow.cpp
+++ b/src/libANGLE/renderer/d3d/d3d11/winrt/CoreWindowNativeWindow.cpp
@@ -64,7 +64,8 @@
         // A EGLRenderSurfaceSizeProperty and a EGLRenderResolutionScaleProperty can't both be specified
         if (mSwapChainScaleSpecified && mSwapChainSizeSpecified)
         {
-            ERR("It is invalid to specify both an EGLRenderSurfaceSizeProperty and a EGLRenderResolutionScaleProperty.");
+            ERR() << "It is invalid to specify both an EGLRenderSurfaceSizeProperty and a "
+                     "EGLRenderResolutionScaleProperty.";
             return false;
         }
     }
diff --git a/src/libANGLE/renderer/d3d/d3d11/winrt/InspectableNativeWindow.cpp b/src/libANGLE/renderer/d3d/d3d11/winrt/InspectableNativeWindow.cpp
index 5bf67f9..cc81521 100644
--- a/src/libANGLE/renderer/d3d/d3d11/winrt/InspectableNativeWindow.cpp
+++ b/src/libANGLE/renderer/d3d/d3d11/winrt/InspectableNativeWindow.cpp
@@ -83,7 +83,8 @@
     // considered invalid.
     if (SUCCEEDED(result) && !hasEglNativeWindowPropertyKey)
     {
-        ERR("Could not find EGLNativeWindowTypeProperty in IPropertySet. Valid EGLNativeWindowTypeProperty values include ICoreWindow");
+        ERR() << "Could not find EGLNativeWindowTypeProperty in IPropertySet. Valid "
+                 "EGLNativeWindowTypeProperty values include ICoreWindow";
         return false;
     }
 
diff --git a/src/libANGLE/renderer/d3d/d3d11/winrt/NativeWindow11WinRT.cpp b/src/libANGLE/renderer/d3d/d3d11/winrt/NativeWindow11WinRT.cpp
index a5ce4ca..2ef2235 100644
--- a/src/libANGLE/renderer/d3d/d3d11/winrt/NativeWindow11WinRT.cpp
+++ b/src/libANGLE/renderer/d3d/d3d11/winrt/NativeWindow11WinRT.cpp
@@ -62,9 +62,8 @@
     }
     else
     {
-        ERR(
-            "Invalid IInspectable EGLNativeWindowType detected. Valid IInspectables include "
-            "ICoreWindow, ISwapChainPanel and IPropertySet");
+        ERR() << "Invalid IInspectable EGLNativeWindowType detected. Valid IInspectables include "
+                 "ICoreWindow, ISwapChainPanel and IPropertySet";
     }
 
     return false;
diff --git a/src/libANGLE/renderer/d3d/d3d11/winrt/SwapChainPanelNativeWindow.cpp b/src/libANGLE/renderer/d3d/d3d11/winrt/SwapChainPanelNativeWindow.cpp
index 1dae1ad..0887257 100644
--- a/src/libANGLE/renderer/d3d/d3d11/winrt/SwapChainPanelNativeWindow.cpp
+++ b/src/libANGLE/renderer/d3d/d3d11/winrt/SwapChainPanelNativeWindow.cpp
@@ -78,7 +78,8 @@
             // unrecoverable state (probably deadlocked). We therefore terminate the application
             // entirely. This also prevents stack corruption if the async operation is eventually
             // run.
-            ERR("Timeout waiting for async action on UI thread. The UI thread might be blocked.");
+            ERR()
+                << "Timeout waiting for async action on UI thread. The UI thread might be blocked.";
             std::terminate();
             return E_FAIL;
         }
@@ -132,7 +133,8 @@
         // A EGLRenderSurfaceSizeProperty and a EGLRenderResolutionScaleProperty can't both be specified
         if (mSwapChainScaleSpecified && mSwapChainSizeSpecified)
         {
-            ERR("It is invalid to specify both an EGLRenderSurfaceSizeProperty and a EGLRenderResolutionScaleProperty.");
+            ERR() << "It is invalid to specify both an EGLRenderSurfaceSizeProperty and a "
+                     "EGLRenderResolutionScaleProperty.";
             return false;
         }
     }
@@ -352,4 +354,4 @@
 
     return result;
 }
-}
\ No newline at end of file
+}
diff --git a/src/libANGLE/renderer/d3d/d3d9/Renderer9.cpp b/src/libANGLE/renderer/d3d/d3d9/Renderer9.cpp
index 680c47f..9f76331 100644
--- a/src/libANGLE/renderer/d3d/d3d9/Renderer9.cpp
+++ b/src/libANGLE/renderer/d3d/d3d9/Renderer9.cpp
@@ -2258,13 +2258,13 @@
 
     if (FAILED(result))
     {
-        ERR("Reset/ResetEx failed multiple times: 0x%08X", result);
+        ERR() << "Reset/ResetEx failed multiple times, " << gl::FmtHR(result);
         return false;
     }
 
     if (removedDevice && lost)
     {
-        ERR("Device lost reset failed multiple times");
+        ERR() << "Device lost reset failed multiple times";
         return false;
     }
 
diff --git a/src/libANGLE/renderer/d3d/d3d9/StateManager9.cpp b/src/libANGLE/renderer/d3d/d3d9/StateManager9.cpp
index 013b30f..17ece72 100644
--- a/src/libANGLE/renderer/d3d/d3d9/StateManager9.cpp
+++ b/src/libANGLE/renderer/d3d/d3d9/StateManager9.cpp
@@ -750,7 +750,7 @@
 {
     if (enabled)
     {
-        FIXME("Sample alpha to coverage is unimplemented.");
+        UNREACHABLE();
     }
 }
 
diff --git a/src/libANGLE/renderer/d3d/d3d9/SwapChain9.cpp b/src/libANGLE/renderer/d3d/d3d9/SwapChain9.cpp
index 7e6948e..abf4846 100644
--- a/src/libANGLE/renderer/d3d/d3d9/SwapChain9.cpp
+++ b/src/libANGLE/renderer/d3d/d3d9/SwapChain9.cpp
@@ -7,11 +7,12 @@
 // SwapChain9.cpp: Implements a back-end specific class for the D3D9 swap chain.
 
 #include "libANGLE/renderer/d3d/d3d9/SwapChain9.h"
-#include "libANGLE/renderer/d3d/d3d9/renderer9_utils.h"
+
+#include "libANGLE/features.h"
 #include "libANGLE/renderer/d3d/d3d9/formatutils9.h"
 #include "libANGLE/renderer/d3d/d3d9/NativeWindow9.h"
 #include "libANGLE/renderer/d3d/d3d9/Renderer9.h"
-#include "libANGLE/features.h"
+#include "libANGLE/renderer/d3d/d3d9/renderer9_utils.h"
 
 namespace rx
 {
@@ -126,7 +127,7 @@
                                        &mOffscreenTexture, pShareHandle);
         if (FAILED(result))
         {
-            ERR("Could not create offscreen texture: %08lX", result);
+            ERR() << "Could not create offscreen texture, " << gl::FmtHR(result);
             release();
 
             if (d3d9::isDeviceLostError(result))
@@ -212,7 +213,8 @@
         {
             ASSERT(result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY || result == D3DERR_INVALIDCALL || result == D3DERR_DEVICELOST);
 
-            ERR("Could not create additional swap chains or offscreen surfaces: %08lX", result);
+            ERR() << "Could not create additional swap chains or offscreen surfaces, "
+                  << gl::FmtHR(result);
             release();
 
             if (d3d9::isDeviceLostError(result))
@@ -240,7 +242,8 @@
         {
             ASSERT(result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY || result == D3DERR_INVALIDCALL);
 
-            ERR("Could not create depthstencil surface for new swap chain: 0x%08X", result);
+            ERR() << "Could not create depthstencil surface for new swap chain, "
+                  << gl::FmtHR(result);
             release();
 
             if (d3d9::isDeviceLostError(result))
diff --git a/src/libANGLE/renderer/gl/ProgramGL.cpp b/src/libANGLE/renderer/gl/ProgramGL.cpp
index 7da6c98..3769811 100644
--- a/src/libANGLE/renderer/gl/ProgramGL.cpp
+++ b/src/libANGLE/renderer/gl/ProgramGL.cpp
@@ -612,7 +612,7 @@
             warning = "Program link failed unexpectedly with no info log.";
         }
         ANGLEPlatformCurrent()->logWarning(warning.c_str());
-        TRACE("\n%s", warning.c_str());
+        WARN() << std::endl << warning;
 
         // TODO, return GL_OUT_OF_MEMORY or just fail the link? This is an unexpected case
         return false;
diff --git a/src/libANGLE/renderer/gl/RendererGL.cpp b/src/libANGLE/renderer/gl/RendererGL.cpp
index 7865ee2..55b9f12 100644
--- a/src/libANGLE/renderer/gl/RendererGL.cpp
+++ b/src/libANGLE/renderer/gl/RendererGL.cpp
@@ -93,8 +93,12 @@
       default:                             severityText = "UNKNOWN";      break;
     }
 
-    ERR("\n\tSource: %s\n\tType: %s\n\tID: %d\n\tSeverity: %s\n\tMessage: %s", sourceText.c_str(), typeText.c_str(), id,
-        severityText.c_str(), message);
+    ERR() << std::endl
+          << "\tSource: " << sourceText << std::endl
+          << "\tType: " << typeText << std::endl
+          << "\tID: " << id << std::endl
+          << "\tSeverity: " << severityText << std::endl
+          << "\tMessage: " << message;
 }
 #endif
 
diff --git a/src/libANGLE/renderer/gl/ShaderGL.cpp b/src/libANGLE/renderer/gl/ShaderGL.cpp
index 9c62b03..8fc7d46 100644
--- a/src/libANGLE/renderer/gl/ShaderGL.cpp
+++ b/src/libANGLE/renderer/gl/ShaderGL.cpp
@@ -128,11 +128,11 @@
             mShaderID = 0;
 
             *infoLog = &buf[0];
-            TRACE("\n%s", infoLog->c_str());
+            WARN() << std::endl << *infoLog;
         }
         else
         {
-            TRACE("\nShader compilation failed with no info log.");
+            WARN() << std::endl << "Shader compilation failed with no info log.";
         }
         return false;
     }
diff --git a/src/libANGLE/renderer/gl/egl/SurfaceEGL.cpp b/src/libANGLE/renderer/gl/egl/SurfaceEGL.cpp
index ecb58f9..364def9 100644
--- a/src/libANGLE/renderer/gl/egl/SurfaceEGL.cpp
+++ b/src/libANGLE/renderer/gl/egl/SurfaceEGL.cpp
@@ -94,7 +94,7 @@
     EGLBoolean success = mEGL->swapInterval(interval);
     if (success == EGL_FALSE)
     {
-        ERR("eglSwapInterval error 0x%04x", mEGL->getError());
+        ERR() << "eglSwapInterval error " << egl::Error(mEGL->getError());
         ASSERT(false);
     }
 }
diff --git a/src/libANGLE/renderer/gl/egl/android/DisplayAndroid.cpp b/src/libANGLE/renderer/gl/egl/android/DisplayAndroid.cpp
index dad50b8..9ff8c01 100644
--- a/src/libANGLE/renderer/gl/egl/android/DisplayAndroid.cpp
+++ b/src/libANGLE/renderer/gl/egl/android/DisplayAndroid.cpp
@@ -115,7 +115,7 @@
     EGLBoolean success = mEGL->makeCurrent(EGL_NO_SURFACE, EGL_NO_CONTEXT);
     if (success == EGL_FALSE)
     {
-        ERR("eglMakeCurrent error 0x%04x", mEGL->getError());
+        ERR() << "eglMakeCurrent error " << egl::Error(mEGL->getError());
     }
 
     if (mDummyPbuffer != EGL_NO_SURFACE)
@@ -124,7 +124,7 @@
         mDummyPbuffer = EGL_NO_SURFACE;
         if (success == EGL_FALSE)
         {
-            ERR("eglDestroySurface error 0x%04x", mEGL->getError());
+            ERR() << "eglDestroySurface error " << egl::Error(mEGL->getError());
         }
     }
 
@@ -134,14 +134,14 @@
         mContext = EGL_NO_CONTEXT;
         if (success == EGL_FALSE)
         {
-            ERR("eglDestroyContext error 0x%04x", mEGL->getError());
+            ERR() << "eglDestroyContext error " << egl::Error(mEGL->getError());
         }
     }
 
     egl::Error result = mEGL->terminate();
     if (result.isError())
     {
-        ERR("eglTerminate error 0x%04x", result.getCode());
+        ERR() << "eglTerminate error " << result;
     }
 
     SafeDelete(mEGL);