Chromium Code Reviews| Index: tools/relocation_packer/src/relocation_packer_debug.cc |
| diff --git a/tools/relocation_packer/src/relocation_packer_debug.cc b/tools/relocation_packer/src/relocation_packer_debug.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..add97baa48b9b87618b103174324bab16607e314 |
| --- /dev/null |
| +++ b/tools/relocation_packer/src/relocation_packer_debug.cc |
| @@ -0,0 +1,44 @@ |
| +// Copyright 2014 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 <stdarg.h> |
| +#include <stdio.h> |
| + |
| +#include "relocation_packer_debug.h" |
| + |
| +namespace relocation_packer { |
| + |
| +Logger* Logger::instance_ = NULL; |
| + |
| +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).
|
| + if (instance_ == NULL) |
| + instance_ = new Logger; |
| + return instance_; |
| +} |
| + |
| +void Logger::Log(const char* format, va_list args) { |
| + vfprintf(stdout, format, args); |
| +} |
| + |
| +void Logger::Log(const char* format, ...) { |
| + va_list args; |
| + va_start(args, format); |
| + GetInstance()->Log(format, args); |
| + va_end(args); |
| +} |
| + |
| +void Logger::VLog(const char* format, ...) { |
| + if (GetInstance()->is_verbose_) { |
| + va_list args; |
| + va_start(args, format); |
| + GetInstance()->Log(format, args); |
| + va_end(args); |
| + } |
| +} |
| + |
| +void Logger::SetVerbose(bool flag) { |
| + GetInstance()->is_verbose_ = flag; |
| +} |
| + |
| +} // namespace relocation_packer |