MongoDB C++ Driver 4.1.0
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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 <memory>
18
20
22
24
25namespace mongocxx {
26namespace v_noabi {
27
40
50
57class logger {
58 public:
59 virtual ~logger();
60
61 logger(logger&&) = default;
62 logger& operator=(logger&&) = default;
63 logger(logger const&) = default;
64 logger& operator=(logger const&) = default;
65
76 virtual void operator()(
77 log_level level,
79 bsoncxx::v_noabi::stdx::string_view message) noexcept = 0;
80
81 protected:
86};
87
88} // namespace v_noabi
89} // namespace mongocxx
90
91namespace mongocxx {
92
94
95} // namespace mongocxx
96
98
A polyfill for std::string_view.
Definition string_view.hpp:411
virtual void operator()(log_level level, bsoncxx::v_noabi::stdx::string_view domain, bsoncxx::v_noabi::stdx::string_view message) noexcept=0
Handles a log message. User defined logger implementations may do whatever they wish when this is cal...
logger()
Default constructor.
Declares utilities related to mongocxx logging.
#define MONGOCXX_ABI_EXPORT_CDECL(...)
Equivalent to MONGOCXX_ABI_EXPORT with MONGOCXX_ABI_CDECL.
Definition export.hpp:52
The mongocxx v_noabi macro guard postlude header.
The mongocxx v_noabi macro guard prelude header.
Declares entities whose ABI stability is NOT guaranteed.
bsoncxx::v_noabi::stdx::string_view to_string(log_level level)
Returns a stringification of the given log level.
log_level
The log level of a log message.
Definition logger.hpp:31
@ k_debug
Log Level Debug.
Definition logger.hpp:37
@ k_warning
Log Level Warning.
Definition logger.hpp:34
@ k_trace
Log Level Trace.
Definition logger.hpp:38
@ k_error
Log Level Error.
Definition logger.hpp:32
@ k_critical
Log Level Critical.
Definition logger.hpp:33
@ k_message
Log Level Message.
Definition logger.hpp:35
@ k_info
Log Level Info.
Definition logger.hpp:36
The top-level namespace within which all mongocxx library entities are declared.
Provides std::string_view-related polyfills for library API usage.