]> git.proxmox.com Git - ceph.git/blob - ceph/src/rocksdb/util/stderr_logger.h
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / rocksdb / util / stderr_logger.h
1 // Copyright (c) 2016-present, Facebook, Inc. All rights reserved.
2 // This source code is licensed under the BSD-style license found in the
3 // LICENSE file in the root directory of this source tree. An additional grant
4 // of patent rights can be found in the PATENTS file in the same directory.
5
6 #pragma once
7
8 #include <stdarg.h>
9 #include <stdio.h>
10
11 #include "rocksdb/env.h"
12
13 namespace rocksdb {
14
15 // Prints logs to stderr for faster debugging
16 class StderrLogger : public Logger {
17 public:
18 explicit StderrLogger(const InfoLogLevel log_level = InfoLogLevel::INFO_LEVEL)
19 : Logger(log_level) {}
20
21 // Brings overloaded Logv()s into scope so they're not hidden when we override
22 // a subset of them.
23 using Logger::Logv;
24
25 virtual void Logv(const char* format, va_list ap) override {
26 vfprintf(stderr, format, ap);
27 fprintf(stderr, "\n");
28 }
29 };
30
31 } // namespace rocksdb