MongoDB C++ Driver 4.2.0
Loading...
Searching...
No Matches
logger.hpp
Go to the documentation of this file.
1// Copyright 2009-present MongoDB, Inc.
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15#pragma once
16
17#include <mongocxx/v1/logger-fwd.hpp> // IWYU pragma: export
18
19//
20
22
25
27
28namespace mongocxx {
29namespace v1 {
30
45
47
48BSONCXX_PRIVATE_WARNINGS_PUSH();
49BSONCXX_PRIVATE_WARNINGS_DISABLE(MSVC(4251));
50BSONCXX_PRIVATE_WARNINGS_DISABLE(MSVC(4275));
51
59class logger {
60 public:
64 virtual ~logger();
65
69 logger(logger&&) = default;
70
74 logger& operator=(logger&&) = default;
75
79 logger(logger const&) = default;
80
84 logger& operator=(logger const&) = default;
85
89 logger() = default;
90
104 virtual void operator()(
105 log_level level,
107 bsoncxx::v1::stdx::string_view message) noexcept = 0;
108};
109
110BSONCXX_PRIVATE_WARNINGS_POP();
111
118
119} // namespace v1
120} // namespace mongocxx
121
123
For internal use only!
A polyfill for std::string_view.
Definition string_view.hpp:412
logger(logger &&)=default
Move constructor.
A tag type representing mongoc's default unstructured log handler.
Definition logger.hpp:117
logger(logger const &)=default
Copy constructor.
logger & operator=(logger &&)=default
Move assignment operator.
virtual ~logger()
Destructor.
logger()=default
Default constructor.
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.
logger(logger &&)=default
Move constructor.
logger & operator=(logger const &)=default
Copy assignment operator.
Provides macros to control the set of symbols exported in the ABI.
#define MONGOCXX_ABI_EXPORT_CDECL(...)
Equivalent to MONGOCXX_ABI_EXPORT with MONGOCXX_ABI_CDECL.
Definition export.hpp:52
The mongocxx v1 macro guard postlude header.
The mongocxx v1 macro guard prelude header.
Declares entities whose ABI stability is guaranteed for documented symbols.
log_level
The log level for an unstructured log message.
Definition logger.hpp:36
@ k_debug
MONGOC_LOG_LEVEL_DEBUG.
Definition logger.hpp:42
@ k_warning
MONGOC_LOG_LEVEL_WARNING.
Definition logger.hpp:39
@ k_trace
MONGOC_LOG_LEVEL_TRACE.
Definition logger.hpp:43
@ k_error
MONGOC_LOG_LEVEL_ERROR.
Definition logger.hpp:37
@ k_critical
MONGOC_LOG_LEVEL_CRITICAL.
Definition logger.hpp:38
@ k_message
MONGOC_LOG_LEVEL_MESSAGE.
Definition logger.hpp:40
@ k_info
MONGOC_LOG_LEVEL_INFO.
Definition logger.hpp:41
The top-level namespace within which all mongocxx library entities are declared.
Declares mongocxx::v1::logger.
Provides std::string_view-related polyfills for library API usage.