mirror of
https://github.com/gabime/spdlog.git
synced 2025-02-11 23:20:49 +08:00
![Gabi Melman](/assets/img/avatar_default.png)
Some checks are pending
linux / ${{ matrix.config.compiler}} ${{ matrix.config.version }} (C++${{ matrix.config.cppstd }} ${{ matrix.config.build_type }} ${{ matrix.config.asan == 'ON' && 'ASAN' || '' }}${{ matrix.config.tsan == 'ON' && 'TSAN' || '' }}) (map[asan:ON build_type:Debug … (push) Waiting to run
linux / ${{ matrix.config.compiler}} ${{ matrix.config.version }} (C++${{ matrix.config.cppstd }} ${{ matrix.config.build_type }} ${{ matrix.config.asan == 'ON' && 'ASAN' || '' }}${{ matrix.config.tsan == 'ON' && 'TSAN' || '' }}) (map[build_type:Debug compiler… (push) Waiting to run
linux / ${{ matrix.config.compiler}} ${{ matrix.config.version }} (C++${{ matrix.config.cppstd }} ${{ matrix.config.build_type }} ${{ matrix.config.asan == 'ON' && 'ASAN' || '' }}${{ matrix.config.tsan == 'ON' && 'TSAN' || '' }}) (map[build_type:Release compil… (push) Waiting to run
macos / macOS Clang (C++17, Release) (push) Waiting to run
windows / build (map[BUILD_EXAMPLE:OFF BUILD_SHARED:ON BUILD_TYPE:Release CXX_STANDARD:20 FATAL_ERRORS:ON GENERATOR:Visual Studio 17 2022 USE_STD_FORMAT:ON WCHAR:OFF WCHAR_FILES:OFF]) (push) Waiting to run
windows / build (map[BUILD_EXAMPLE:OFF BUILD_SHARED:ON BUILD_TYPE:Release CXX_STANDARD:20 FATAL_ERRORS:ON GENERATOR:Visual Studio 17 2022 USE_STD_FORMAT:ON WCHAR:ON WCHAR_FILES:ON]) (push) Waiting to run
windows / build (map[BUILD_EXAMPLE:ON BUILD_SHARED:ON BUILD_TYPE:Release CXX_STANDARD:17 FATAL_ERRORS:ON GENERATOR:Visual Studio 17 2022 USE_STD_FORMAT:OFF WCHAR:OFF WCHAR_FILES:OFF]) (push) Waiting to run
windows / build_2019 (map[BUILD_EXAMPLE:ON BUILD_SHARED:ON BUILD_TYPE:Release CXX_STANDARD:17 FATAL_ERRORS:ON GENERATOR:Visual Studio 16 2019 USE_STD_FORMAT:OFF WCHAR:OFF WCHAR_FILES:OFF]) (push) Waiting to run
windows / build_2019 (map[BUILD_EXAMPLE:ON BUILD_SHARED:ON BUILD_TYPE:Release CXX_STANDARD:20 FATAL_ERRORS:ON GENERATOR:Visual Studio 16 2019 USE_STD_FORMAT:OFF WCHAR:OFF WCHAR_FILES:OFF]) (push) Waiting to run
* Removed SPDLOG_USE_STD_FORMAT * Removed SPDLOG_USE_STD_FORMAT * clang-format * Fix windows.yml ci * Fix ci
41 lines
1.2 KiB
C++
41 lines
1.2 KiB
C++
// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.
|
|
// Distributed under the MIT License (http://opensource.org/licenses/MIT)
|
|
|
|
#include "spdlog/common.h"
|
|
|
|
#include <algorithm>
|
|
#include <iterator>
|
|
|
|
namespace spdlog {
|
|
|
|
spdlog::level level_from_str(const std::string &name) noexcept {
|
|
auto it = std::find(std::begin(level_string_views), std::end(level_string_views), name);
|
|
if (it != std::end(level_string_views)) return static_cast<level>(std::distance(std::begin(level_string_views), it));
|
|
|
|
// check also for "warn" and "err" before giving up
|
|
if (name == "warn") {
|
|
return spdlog::level::warn;
|
|
}
|
|
if (name == "err") {
|
|
return level::err;
|
|
}
|
|
return level::off;
|
|
}
|
|
|
|
spdlog_ex::spdlog_ex(std::string msg)
|
|
: msg_(std::move(msg)) {}
|
|
|
|
spdlog_ex::spdlog_ex(const std::string &msg, int last_errno) {
|
|
memory_buf_t outbuf;
|
|
fmt::format_system_error(outbuf, last_errno, msg.c_str());
|
|
msg_ = fmt::to_string(outbuf);
|
|
}
|
|
|
|
const char *spdlog_ex::what() const noexcept { return msg_.c_str(); }
|
|
|
|
void throw_spdlog_ex(const std::string &msg, int last_errno) { SPDLOG_THROW(spdlog_ex(msg, last_errno)); }
|
|
|
|
void throw_spdlog_ex(std::string msg) { SPDLOG_THROW(spdlog_ex(std::move(msg))); }
|
|
|
|
} // namespace spdlog
|