MongoDB C++ Driver 4.4.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
43
45
46BSONCXX_PRIVATE_WARNINGS_PUSH();
47BSONCXX_PRIVATE_WARNINGS_DISABLE(MSVC(4251));
48BSONCXX_PRIVATE_WARNINGS_DISABLE(MSVC(4275));
49
55class logger {
56 public:
60 virtual ~logger();
61
65 logger(logger&&) = default;
66
70 logger& operator=(logger&&) = default;
71
75 logger(logger const&) = default;
76
80 logger& operator=(logger const&) = default;
81
85 logger() = default;
86
100 virtual void operator()(
101 log_level level,
103 bsoncxx::v1::stdx::string_view message) noexcept = 0;
104};
105
106BSONCXX_PRIVATE_WARNINGS_POP();
107
112
113} // namespace v1
114} // namespace mongocxx
115
117
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:111
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:34
@ k_debug
MONGOC_LOG_LEVEL_DEBUG.
Definition logger.hpp:40
@ k_warning
MONGOC_LOG_LEVEL_WARNING.
Definition logger.hpp:37
@ k_trace
MONGOC_LOG_LEVEL_TRACE.
Definition logger.hpp:41
@ k_error
MONGOC_LOG_LEVEL_ERROR.
Definition logger.hpp:35
@ k_critical
MONGOC_LOG_LEVEL_CRITICAL.
Definition logger.hpp:36
@ k_message
MONGOC_LOG_LEVEL_MESSAGE.
Definition logger.hpp:38
@ k_info
MONGOC_LOG_LEVEL_INFO.
Definition logger.hpp:39
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.