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 "debug.h" |
| 9 |
| 10 namespace relocation_packer { |
| 11 |
| 12 Logger* Logger::instance_ = NULL; |
| 13 |
| 14 Logger* Logger::GetInstance() { |
| 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 |