OGS
Logging.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) OpenGeoSys Community (opengeosys.org)
2// SPDX-License-Identifier: BSD-3-Clause
3
4#pragma once
5
6#include <spdlog/logger.h>
7
8#include <memory>
9#include <string>
10#include <utility>
11
12#include "baselib_export.h"
13
14namespace BaseLib
15{
16extern BASELIB_EXPORT std::shared_ptr<spdlog::logger> console;
17void setConsoleLogLevel(std::string const& level_string);
18void initOGSLogger(std::string const& log_level);
19} // namespace BaseLib
20
21template <typename... Args>
22void DBUG(fmt::format_string<Args...> fmt, Args&&... args)
23{
24 assert(BaseLib::console != nullptr);
25 BaseLib::console->debug(fmt, std::forward<Args>(args)...);
26}
27template <typename... Args>
28void INFO(fmt::format_string<Args...> fmt, Args&&... args)
29{
30 assert(BaseLib::console != nullptr);
31 BaseLib::console->info(fmt, std::forward<Args>(args)...);
32}
33template <typename... Args>
34void WARN(fmt::format_string<Args...> fmt, Args&&... args)
35{
36 assert(BaseLib::console != nullptr);
37 BaseLib::console->warn(fmt, std::forward<Args>(args)...);
38}
39template <typename... Args>
40void ERR(fmt::format_string<Args...> fmt, Args&&... args)
41{
42 assert(BaseLib::console != nullptr);
43 BaseLib::console->error(fmt, std::forward<Args>(args)...);
44}
45template <typename... Args>
46void CRITICAL(fmt::format_string<Args...> fmt, Args&&... args)
47{
48 assert(BaseLib::console != nullptr);
49 BaseLib::console->critical(fmt, std::forward<Args>(args)...);
50}
void INFO(fmt::format_string< Args... > fmt, Args &&... args)
Definition Logging.h:28
void DBUG(fmt::format_string< Args... > fmt, Args &&... args)
Definition Logging.h:22
void ERR(fmt::format_string< Args... > fmt, Args &&... args)
Definition Logging.h:40
void WARN(fmt::format_string< Args... > fmt, Args &&... args)
Definition Logging.h:34
void CRITICAL(fmt::format_string< Args... > fmt, Args &&... args)
Definition Logging.h:46
#define BASELIB_EXPORT
void initOGSLogger(std::string const &log_level)
Definition Logging.cpp:56
void setConsoleLogLevel(std::string const &level_string)
Definition Logging.cpp:39
std::shared_ptr< spdlog::logger > console
Definition Logging.cpp:37
Definition AABB.h:277