summaryrefslogtreecommitdiffstats
path: root/remoting/base/logger.cc
blob: f4def7bc9503fc6b51a0e7702c5bbc37aab94fa7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
// Copyright (c) 2011 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 "remoting/base/logger.h"

#include <stdarg.h>  // va_list

#include "base/stringprintf.h"

namespace remoting {

// Copied from base/logging.cc.
const char* const Logger::log_severity_names[logging::LOG_NUM_SEVERITIES] = {
  "INFO", "WARNING", "ERROR", "ERROR_REPORT", "FATAL" };

Logger::Logger() {
}

Logger::~Logger() {
}

void Logger::Log(logging::LogSeverity severity, const char* format, ...) {
  va_list ap;
  va_start(ap, format);
  va_Log(severity, format, ap);
  va_end(ap);
}

void Logger::VLog(int verboselevel, const char* format, ...) {
  va_list ap;
  va_start(ap, format);
  va_VLog(verboselevel, format, ap);
  va_end(ap);
}

void Logger::va_Log(logging::LogSeverity severity,
                          const char* format, va_list ap) {
  std::string message;
  base::StringAppendV(&message, format, ap);
  logging::LogMessage(__FILE__, __LINE__, severity).stream() << message;
}

void Logger::va_VLog(int verboselevel, const char* format, va_list ap) {
  std::string message;
  base::StringAppendV(&message, format, ap);
  VLOG(verboselevel) << message;
}

}  // namespace remoting