Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2014 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 <stdarg.h> | |
| 6 #include <stdio.h> | |
| 7 | |
| 8 #include "relocation_packer_debug.h" | |
| 9 | |
| 10 namespace relocation_packer { | |
| 11 | |
| 12 Logger* Logger::instance_ = NULL; | |
| 13 | |
| 14 Logger* Logger::GetInstance() { | |
|
rmcilroy
2014/06/02 15:16:35
nit - can you mention somewhere that this is expli
simonb (inactive)
2014/06/04 16:40:35
Done (in debug.h).
| |
| 15 if (instance_ == NULL) | |
| 16 instance_ = new Logger; | |
| 17 return instance_; | |
| 18 } | |
| 19 | |
| 20 void Logger::Log(const char* format, va_list args) { | |
| 21 vfprintf(stdout, format, args); | |
| 22 } | |
| 23 | |
| 24 void Logger::Log(const char* format, ...) { | |
| 25 va_list args; | |
| 26 va_start(args, format); | |
| 27 GetInstance()->Log(format, args); | |
| 28 va_end(args); | |
| 29 } | |
| 30 | |
| 31 void Logger::VLog(const char* format, ...) { | |
| 32 if (GetInstance()->is_verbose_) { | |
| 33 va_list args; | |
| 34 va_start(args, format); | |
| 35 GetInstance()->Log(format, args); | |
| 36 va_end(args); | |
| 37 } | |
| 38 } | |
| 39 | |
| 40 void Logger::SetVerbose(bool flag) { | |
| 41 GetInstance()->is_verbose_ = flag; | |
| 42 } | |
| 43 | |
| 44 } // namespace relocation_packer | |
| OLD | NEW |