]>
git.proxmox.com Git - ceph.git/blob - ceph/src/rocksdb/java/rocksjni/loggerjnicallback.h
1 // Copyright (c) 2011-present, Facebook, Inc. All rights reserved.
2 // This source code is licensed under both the GPLv2 (found in the
3 // COPYING file in the root directory) and Apache 2.0 License
4 // (found in the LICENSE.Apache file in the root directory).
6 // This file implements the callback "bridge" between Java and C++ for
9 #ifndef JAVA_ROCKSJNI_LOGGERJNICALLBACK_H_
10 #define JAVA_ROCKSJNI_LOGGERJNICALLBACK_H_
15 #include "rocksjni/jnicallback.h"
16 #include "port/port.h"
17 #include "rocksdb/env.h"
21 class LoggerJniCallback
: public JniCallback
, public Logger
{
23 LoggerJniCallback(JNIEnv
* env
, jobject jLogger
);
26 using Logger::SetInfoLogLevel
;
27 using Logger::GetInfoLogLevel
;
28 // Write an entry to the log file with the specified format.
29 virtual void Logv(const char* format
, va_list ap
);
30 // Write an entry to the log file with the specified log level
31 // and format. Any log with level under the internal log level
32 // of *this (see @SetInfoLogLevel and @GetInfoLogLevel) will not be
34 virtual void Logv(const InfoLogLevel log_level
,
35 const char* format
, va_list ap
);
38 jmethodID m_jLogMethodId
;
39 jobject m_jdebug_level
;
40 jobject m_jinfo_level
;
41 jobject m_jwarn_level
;
42 jobject m_jerror_level
;
43 jobject m_jfatal_level
;
44 jobject m_jheader_level
;
45 std::unique_ptr
<char[]> format_str(const char* format
, va_list ap
) const;
47 } // namespace rocksdb
49 #endif // JAVA_ROCKSJNI_LOGGERJNICALLBACK_H_