MongoDB C++ Driver current
Loading...
Searching...
No Matches
logger.hpp
1// Copyright 2015 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
19#include <bsoncxx/stdx/string_view.hpp>
20#include <mongocxx/stdx.hpp>
21
22#include <mongocxx/config/prelude.hpp>
23
24namespace mongocxx {
25inline namespace v_noabi {
29enum class log_level {
30 k_error,
31 k_critical,
32 k_warning,
33 k_message,
34 k_info,
35 k_debug,
36 k_trace,
37};
38
47MONGOCXX_API stdx::string_view MONGOCXX_CALL to_string(log_level level);
48
52class MONGOCXX_API logger {
53 public:
54 virtual ~logger();
55
66 virtual void operator()(log_level level,
67 stdx::string_view domain,
68 stdx::string_view message) noexcept = 0;
69
70 protected:
75};
76
77} // namespace v_noabi
78} // namespace mongocxx
79
80#include <mongocxx/config/postlude.hpp>
The interface that all user-defined loggers must implement.
Definition logger.hpp:52
virtual void operator()(log_level level, stdx::string_view domain, stdx::string_view message) noexcept=0
Handles a log message.
logger()
Default constructor.
stdx::string_view to_string(log_level level)
Returns a stringification of the given log level.
log_level
The log level of a message passed to a mongocxx::logger.
Definition logger.hpp:29
The top-level namespace for mongocxx library entities.
Definition bulk_write.hpp:24