Loading...
Searching...
No Matches
logger.hpp
Go to the documentation of this file.
// Copyright 2009-present MongoDB, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#pragma once
#include <mongocxx/v1/logger-fwd.hpp> // IWYU pragma: export
//
#include <mongocxx/v1/detail/prelude.hpp>
#include <bsoncxx/v1/detail/macros.hpp>
#include <bsoncxx/v1/stdx/string_view.hpp>
#include <mongocxx/v1/config/export.hpp>
namespace mongocxx {
namespace v1 {
enum class log_level {
k_error,
k_critical,
k_warning,
k_message,
k_info,
k_debug,
k_trace,
};
MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v1::stdx::string_view) to_string(log_level level);
BSONCXX_PRIVATE_WARNINGS_PUSH();
BSONCXX_PRIVATE_WARNINGS_DISABLE(MSVC(4251));
BSONCXX_PRIVATE_WARNINGS_DISABLE(MSVC(4275));
class logger {
public:
virtual ~logger();
logger(logger&&) = default;
logger& operator=(logger&&) = default;
logger(logger const&) = default;
logger& operator=(logger const&) = default;
logger() = default;
virtual void operator()(
log_level level,
bsoncxx::v1::stdx::string_view domain,
bsoncxx::v1::stdx::string_view message) noexcept = 0;
};
BSONCXX_PRIVATE_WARNINGS_POP();
class default_logger {};
} // namespace v1
} // namespace mongocxx
#include <mongocxx/v1/detail/postlude.hpp>
macros.hpp
For internal use only!
bsoncxx::v1::stdx::string_view
A polyfill for std::string_view.
Definition string_view.hpp:412
mongocxx::logger::logger
logger(logger &&)=default
Move constructor.
mongocxx::v1::default_logger
A tag type representing mongoc's default unstructured log handler.
Definition logger.hpp:111
mongocxx::v1::logger::logger
logger(logger const &)=default
Copy constructor.
mongocxx::v1::logger::operator=
logger & operator=(logger &&)=default
Move assignment operator.
mongocxx::v1::logger::~logger
virtual ~logger()
Destructor.
mongocxx::v1::logger::logger
logger()=default
Default constructor.
mongocxx::v1::logger::operator()
virtual void operator()(log_level level, bsoncxx::v1::stdx::string_view domain, bsoncxx::v1::stdx::string_view message) noexcept=0
Handle an unstructured log message emitted by mongoc.
mongocxx::v1::logger::logger
logger(logger &&)=default
Move constructor.
mongocxx::v1::logger::operator=
logger & operator=(logger const &)=default
Copy assignment operator.
export.hpp
Provides macros to control the set of symbols exported in the ABI.
MONGOCXX_ABI_EXPORT_CDECL
#define MONGOCXX_ABI_EXPORT_CDECL(...)
Equivalent to MONGOCXX_ABI_EXPORT with MONGOCXX_ABI_CDECL.
Definition export.hpp:52
postlude.hpp
The mongocxx v1 macro guard postlude header.
prelude.hpp
The mongocxx v1 macro guard prelude header.
mongocxx::v1
Declares entities whose ABI stability is guaranteed for documented symbols.
mongocxx::v1::log_level
log_level
The log level for an unstructured log message.
Definition logger.hpp:34
mongocxx::v1::log_level::k_debug
@ k_debug
MONGOC_LOG_LEVEL_DEBUG.
Definition logger.hpp:40
mongocxx::v1::log_level::k_warning
@ k_warning
MONGOC_LOG_LEVEL_WARNING.
Definition logger.hpp:37
mongocxx::v1::log_level::k_trace
@ k_trace
MONGOC_LOG_LEVEL_TRACE.
Definition logger.hpp:41
mongocxx::v1::log_level::k_error
@ k_error
MONGOC_LOG_LEVEL_ERROR.
Definition logger.hpp:35
mongocxx::v1::log_level::k_critical
@ k_critical
MONGOC_LOG_LEVEL_CRITICAL.
Definition logger.hpp:36
mongocxx::v1::log_level::k_message
@ k_message
MONGOC_LOG_LEVEL_MESSAGE.
Definition logger.hpp:38
mongocxx::v1::log_level::k_info
@ k_info
MONGOC_LOG_LEVEL_INFO.
Definition logger.hpp:39
mongocxx
The top-level namespace within which all mongocxx library entities are declared.
logger-fwd.hpp
Declares mongocxx::v1::logger.
string_view.hpp
Provides std::string_view-related polyfills for library API usage.