- add sources.
[platform/framework/web/crosswalk.git] / src / gpu / command_buffer / common / logging_android.cc
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include <android/log.h>
6 #include <iostream>
7 #include <sstream>
8
9 #include "gpu/command_buffer/common/logging.h"
10
11 namespace gpu {
12
13 namespace {
14 std::stringstream* g_log;
15 const char* kLogTag = "chromium-gpu";
16 }
17
18 std::ostream& Logger::stream() {
19   if (!g_log)
20     g_log = new std::stringstream();
21   return *g_log;
22 }
23
24 Logger::~Logger() {
25   if (!condition_) {
26     __android_log_print(ANDROID_LOG_INFO, kLogTag, "%s", g_log->str().c_str());
27     g_log->str(std::string());
28     if (level_ == FATAL)
29       assert(false);
30   }
31 }
32
33 }  // namespace gpu