Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / chromeos / drive / logging.cc
blobb939c46bcdb7d81f2cbc78f419db1eb18db29755
1 // Copyright (c) 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.
5 #include "chrome/browser/chromeos/drive/logging.h"
7 #include <stdarg.h> // va_list
8 #include <string>
10 #include "base/lazy_instance.h"
11 #include "base/strings/stringprintf.h"
12 #include "chrome/browser/drive/event_logger.h"
14 namespace drive {
15 namespace util {
16 namespace {
18 static base::LazyInstance<EventLogger> g_logger =
19 LAZY_INSTANCE_INITIALIZER;
21 } // namespace
23 void Log(logging::LogSeverity severity, const char* format, ...) {
24 std::string what;
26 va_list args;
27 va_start(args, format);
28 base::StringAppendV(&what, format, args);
29 va_end(args);
31 DVLOG(1) << what;
33 // On thread-safety: LazyInstance guarantees thread-safety for the object
34 // creation. EventLogger::Log() internally maintains the lock.
35 EventLogger* ptr = g_logger.Pointer();
36 ptr->Log(severity, what);
39 std::vector<EventLogger::Event> GetLogHistory() {
40 EventLogger* ptr = g_logger.Pointer();
41 return ptr->GetHistory();
44 } // namespace util
45 } // namespace drive