Realm C++ SDK Version v2.2.0

logger.hpp

1
2//
3// Copyright 2024 Realm Inc.
4//
5// Licensed under the Apache License, Version 2.0 (the "License");
6// you may not use this file except in compliance with the License.
7// You may obtain a copy of the License at
8//
9// http://www.apache.org/licenses/LICENSE-2.0
10//
11// Unless required by applicable law or agreed to in writing, software
12// distributed under the License is distributed on an "AS IS" BASIS,
13// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14// See the License for the specific language governing permissions and
15// limitations under the License.
16//
18
19#ifndef CPPREALM_LOGGER_HPP
20#define CPPREALM_LOGGER_HPP
21
22#include <memory>
23#include <string>
24
25namespace realm {
26
27 struct logger {
40 enum class level { all = 0,
41 trace = 1,
42 debug = 2,
43 detail = 3,
44 info = 4,
45 warn = 5,
46 error = 6,
47 fatal = 7,
48 off = 8 };
49 virtual void do_log(level, const std::string &) = 0;
50 virtual inline ~logger() noexcept = default;
51 void set_level_threshold(level l) {
52 m_level_threshold = l;
53 }
54
55 level get_level_threshold() const {
56 return m_level_threshold;
57 }
58 protected:
59 level m_level_threshold;
60 };
61
62 void set_default_logger(std::shared_ptr<struct logger> &&);
63}
64
65#endif//CPPREALM_LOGGER_HPP
Definition: logger.hpp:27
level
Definition: logger.hpp:40