]> git.proxmox.com Git - ceph.git/blame - ceph/src/jaegertracing/jaeger-client-cpp/src/jaegertracing/Logging.cpp
buildsys: switch source download to quincy
[ceph.git] / ceph / src / jaegertracing / jaeger-client-cpp / src / jaegertracing / Logging.cpp
CommitLineData
f67539c2
TL
1/*
2 * Copyright (c) 2017 Uber Technologies, Inc.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#include "jaegertracing/Logging.h"
18
19#include <iostream>
20
21namespace jaegertracing {
22namespace logging {
23namespace {
24
25class NullLogger : public Logger {
26 public:
27 void error(const std::string& /* message */) override {}
28
29 void info(const std::string& /* message */) override {}
30};
31
32class ConsoleLogger : public Logger {
33 public:
34 void error(const std::string& message) override
35 {
36 std::cerr << "ERROR: " << message << '\n';
37 }
38
39 void info(const std::string& message) override
40 {
41 std::cout << "INFO: " << message << '\n';
42 }
43};
44
45} // anonymous namespace
46
47std::unique_ptr<Logger> nullLogger()
48{
49 return std::unique_ptr<Logger>(new NullLogger());
50}
51
52std::unique_ptr<Logger> consoleLogger()
53{
54 return std::unique_ptr<Logger>(new ConsoleLogger());
55}
56
57} // namespace logging
58} // namespace jaegertracing