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
10 #include "base/lazy_instance.h"
11 #include "base/strings/stringprintf.h"
12 #include "chrome/browser/drive/event_logger.h"
18 static base::LazyInstance
<EventLogger
> g_logger
=
19 LAZY_INSTANCE_INITIALIZER
;
23 void Log(logging::LogSeverity severity
, const char* format
, ...) {
27 va_start(args
, format
);
28 base::StringAppendV(&what
, format
, args
);
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();