MongoDB C++ Driver mongocxx-3.0.3
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 {
25MONGOCXX_INLINE_NAMESPACE_BEGIN
26
30enum class log_level {
31 k_error,
32 k_critical,
33 k_warning,
34 k_message,
35 k_info,
36 k_debug,
37 k_trace,
38};
39
48MONGOCXX_API stdx::string_view MONGOCXX_CALL to_string(log_level level);
49
53class MONGOCXX_API logger {
54 public:
55 virtual ~logger();
56
67 virtual void operator()(log_level level, stdx::string_view domain,
68 stdx::string_view message) noexcept = 0;
69
70 protected:
75};
76
77MONGOCXX_INLINE_NAMESPACE_END
78} // namespace mongocxx
79
80#include <mongocxx/config/postlude.hpp>
The interface that all user-defined loggers must implement.
Definition logger.hpp:53
logger()
Default constructor.
virtual void operator()(log_level level, stdx::string_view domain, stdx::string_view message) noexcept=0
Handles a log message.