Lagrange
Logger.h
1/*
2 * Copyright 2019 Adobe. All rights reserved.
3 * This file is licensed to you under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License. You may obtain a copy
5 * of the License at http://www.apache.org/licenses/LICENSE-2.0
6 *
7 * Unless required by applicable law or agreed to in writing, software distributed under
8 * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9 * OF ANY KIND, either express or implied. See the License for the specific language
10 * governing permissions and limitations under the License.
11 */
12#pragma once
13
14#include <lagrange/api.h>
15
16// clang-format off
17#include <lagrange/utils/warnoff.h>
18#include <spdlog/spdlog.h>
19#include <lagrange/utils/warnon.h>
20// clang-format on
21
22namespace lagrange {
23
49
55LA_CORE_API spdlog::logger& logger();
56
63LA_CORE_API void set_logger(std::shared_ptr<spdlog::logger> logger);
64
69class LA_CORE_API ScopedLogLevel
70{
71public:
79 ScopedLogLevel(spdlog::level::level_enum level, spdlog::logger& logger = lagrange::logger());
81
83 ScopedLogLevel& operator=(ScopedLogLevel&&) = delete;
84 ScopedLogLevel(const ScopedLogLevel&) = delete;
85 ScopedLogLevel& operator=(const ScopedLogLevel&) = delete;
86
87private:
88 spdlog::level::level_enum m_prev_level;
89 spdlog::logger* m_logger;
90};
91
93
94} // namespace lagrange
Changes the level of logger to something else in a scope.
Definition: Logger.h:70
LA_CORE_API void set_logger(std::shared_ptr< spdlog::logger > logger)
Setup a logger object to be used by Lagrange.
Definition: Logger.cpp:57
LA_CORE_API spdlog::logger & logger()
Retrieves the current logger.
Definition: Logger.cpp:40
Main namespace for Lagrange.
Definition: AABBIGL.h:30