Add Log.h to replace all uses of iostream

On Android iostream doesn't appear in logcat, the system log that's
often used for printf debugging. Introduce Chromium/ANGLE like logging
that looks like the following:

  InfoLog() << stuff << stuff;

This makes sure the message is put in logcat on Android and removes
static initializers from <iostream>

BUG=dawn:286

Change-Id: Ie0d018f49bcac1a7b740739a6e59d45ae6728638
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14102
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: David Turner <digit@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
This commit is contained in:
Corentin Wallez
2019-12-05 11:13:01 +00:00
committed by Commit Bot service account
parent 1d6250d016
commit 95586ff184
13 changed files with 256 additions and 56 deletions

View File

@@ -16,12 +16,12 @@
#include "common/Assert.h"
#include "common/Constants.h"
#include "common/Log.h"
#include <shaderc/shaderc.hpp>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <sstream>
namespace utils {
@@ -67,7 +67,7 @@ namespace utils {
shaderc::Compiler compiler;
auto result = compiler.CompileGlslToSpv(source, strlen(source), kind, "myshader?");
if (result.GetCompilationStatus() != shaderc_compilation_status_success) {
std::cerr << result.GetErrorMessage();
ErrorLog() << result.GetErrorMessage();
return {};
}
#ifdef DUMP_SPIRV_ASSEMBLY
@@ -106,7 +106,7 @@ namespace utils {
shaderc::Compiler compiler;
shaderc::SpvCompilationResult result = compiler.AssembleToSpv(source, strlen(source));
if (result.GetCompilationStatus() != shaderc_compilation_status_success) {
std::cerr << result.GetErrorMessage();
ErrorLog() << result.GetErrorMessage();
return {};
}