diff options
Diffstat (limited to 'chromium/gpu/command_buffer/common/logging_android.cc')
-rw-r--r-- | chromium/gpu/command_buffer/common/logging_android.cc | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/chromium/gpu/command_buffer/common/logging_android.cc b/chromium/gpu/command_buffer/common/logging_android.cc new file mode 100644 index 00000000000..d660080d4c7 --- /dev/null +++ b/chromium/gpu/command_buffer/common/logging_android.cc @@ -0,0 +1,33 @@ +// Copyright 2013 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include <android/log.h> +#include <iostream> +#include <sstream> + +#include "gpu/command_buffer/common/logging.h" + +namespace gpu { + +namespace { +std::stringstream* g_log; +const char* kLogTag = "chromium-gpu"; +} + +std::ostream& Logger::stream() { + if (!g_log) + g_log = new std::stringstream(); + return *g_log; +} + +Logger::~Logger() { + if (!condition_) { + __android_log_print(ANDROID_LOG_INFO, kLogTag, "%s", g_log->str().c_str()); + g_log->str(std::string()); + if (level_ == FATAL) + assert(false); + } +} + +} // namespace gpu |