Skip to content

Commit 244b27f

Browse files
committed
make getLogger noexcept
1 parent d328193 commit 244b27f

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/common/logging.hpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
#ifndef OCVSMD_COMMON_LOGGING_HPP_INCLUDED
77
#define OCVSMD_COMMON_LOGGING_HPP_INCLUDED
88

9+
#include "common_helpers.hpp"
10+
911
#include <spdlog/logger.h>
1012
#include <spdlog/spdlog.h>
1113

@@ -20,7 +22,7 @@ namespace common
2022
using Logger = spdlog::logger;
2123
using LoggerPtr = std::shared_ptr<Logger>;
2224

23-
inline LoggerPtr getLogger(const std::string& name)
25+
inline LoggerPtr getLogger(const std::string& name) noexcept
2426
{
2527
if (auto logger = spdlog::get(name))
2628
{
@@ -34,7 +36,11 @@ inline LoggerPtr getLogger(const std::string& name)
3436
CETL_DEBUG_ASSERT(logger, name.c_str());
3537

3638
apply_logger_env_levels(logger);
37-
register_logger(logger);
39+
40+
performWithoutThrowing([&logger] {
41+
//
42+
register_logger(logger);
43+
});
3844

3945
return logger;
4046
}

0 commit comments

Comments
 (0)