gabime/spdlite — dự án mã nguồn mở — đang có 14 sao GitHub. Minimal, header-only C++ logging library. Lite version of spdlog.
Tóm tắt dựng từ metadata GitHub của chính dự án — chưa có bài review TopGit. Trang sẽ tự động cập nhật khi bài review đầy đủ được xuất bản.
VÌ SAO CHƯA CÓ REVIEW
TopGit viết bài đầy đủ cho repo có nhiều sao nhất và được yêu cầu nhiều nhất. Trang này là snapshot trong thời gian chờ — xem README gốc ở tab READ ME.
A small, header-only C++20 logger - the lite version of spdlog, simpler, smaller, fewer features.
Use spdlite if you want a tiny, fast, capable logger.
Install
Copy the include/spdlite/ folder into your build tree - header-only, no build step.
Or via CMake (find_package, FetchContent, or add_subdirectory), link spdlite::spdlite.
See include/spdlite/logger.h for the full API and include/spdlite/sinks/ for the available sinks.
Thread safety
logger_mt is thread-safe - it uses a std::mutex to serialize format and dispatch
per call, so multiple threads can write through the same instance safely.
If you don't require thread safety, you can use logger_st which skips the lock entirely:
spdlite::logger_mt<console_sink> log; // std::mutex
spdlite::logger_st<console_sink> log_st; // no locking
Both share the same API; only the mutex type differs.
Passing loggers around
Every logger derives from spdlite::logger, so code that receives one doesn't need to know
its sinks or mutex type:
Fractional digits: none, ms (3), us (6), or ns (9).
Compile-time level gating
Strip log calls below a chosen severity from the binary entirely - via the SPDLITE_* macros:
#define SPDLITE_ACTIVE_LEVEL SPDLITE_LEVEL_INFO // before the include
#include "spdlite/logger.h"
void hot_path(spdlite::logger& log) {
SPDLITE_DEBUG(log, "value={}", expensive_to_compute()); // gone - args not evaluated
SPDLITE_INFO(log, "did the thing"); // stays
}
Macros: SPDLITE_TRACE, SPDLITE_DEBUG, SPDLITE_INFO, SPDLITE_WARN, SPDLITE_ERROR,
SPDLITE_CRITICAL. Levels: SPDLITE_LEVEL_TRACE (0) ... SPDLITE_LEVEL_OFF (6). Per-TU
setting; default is SPDLITE_LEVEL_TRACE (no elision). The compile-time gate is independent
of the runtime set_log_level() - a call emits only when both gates pass.
Compile times
Most of a logging TU's compile cost is the bundled fmt headers. To cut it:
Gate out cold log calls - see Compile-time level gating above; elided calls cost nothing,
at compile time and runtime.
Compile fmt once - -DSPDLITE_COMPILED_FMT=ON builds fmt's implementation into a small
static lib instead of header-only, so logging TUs compile much faster (~60% per TU) with no
runtime cost and identical output. Worth it from ~2 logging TUs up; gives up pure header-only
(consumers link the lib - automatic via spdlite::spdlite).
Use std::format - -DSPDLITE_USE_STD_FORMAT=ON drops the bundled fmt headers and compiles
~20% faster per TU, but it is a compile-time-for-runtime trade: libstdc++'s std::format is
~1.3-2× slower than bundled fmt on typical messages, so fmt stays the default. Needs a modern
stdlib (libstdc++ 13+, libc++ 17+, MSVC 19.29+).
Build options
CMake isn't required to use spdlite - copy the headers and you're done. The flags below
only apply if you build the bundled example, tests, or benchmarks with the provided
CMakeLists.txt.
Option
Default
Effect
SPDLITE_BUILD_EXAMPLE
ON
Build the example executable.
SPDLITE_BUILD_TESTS
OFF
Build the doctest-based unit tests.
SPDLITE_BUILD_BENCH
OFF
Build the benchmarks (fetches Google Benchmark automatically).
SPDLITE_USE_STD_FORMAT
OFF
CMake option: use <format> instead of bundled fmt - drop fmt/ from the install. Pass via -DSPDLITE_USE_STD_FORMAT=ON.
SPDLITE_COMPILED_FMT
OFF
Compile bundled fmt once into a static lib (not header-only) - faster builds, links spdlite_fmt. Mutually exclusive with SPDLITE_USE_STD_FORMAT.
Trang TopGit này là một snapshot — tab "Readme" hiển thị nguyên văn README của repo (đã bỏ link, giữ ảnh). Repo GitHub ở github.com/gabime/spdlite là nguồn chính thức.
gabime/spdlite có bao nhiêu sao?
gabime/spdlite có 14 sao GitHub — tải lại trang để xem số mới nhất, hoặc xem trực tiếp github.com/gabime/spdlite. TopGit phản chiếu số sao của GitHub nhưng không cam kết đến từng phút.
gabime/spdlite có phải mã nguồn mở không?
Có — gabime/spdlite phát hành theo license MIT, nghĩa là mã nguồn mở để đọc, fork và (tùy license) tái sử dụng. Mã: github.com/gabime/spdlite.
gabime/spdlite còn đang phát triển không?
Commit gần nhất trên gabime/spdlite là 1 tháng trước (theo timestamp GitHub). Repo có 1 fork — một chỉ báo về mức độ quan tâm của cộng đồng.
gabime/spdlite dùng license gì?
gabime/spdlite phát hành theo license MIT. Nên mở file LICENSE trên GitHub để xác nhận — license metadata đôi khi lệch với thực tế dự án.
gabime/spdlite là gì?
gabime/spdlite (gabime/spdlite) là dự án C++ trên GitHub. Theo mô tả gốc: Minimal, header-only C++ logging library. Lite version of spdlog.
gabime/spdlite viết bằng ngôn ngữ gì?
gabime/spdlite chủ yếu viết bằng C++. Trường "language" của GitHub dựa trên phần lớn byte ở nhánh mặc định.
Đọc đầy đủ README ở tab phía trên.
Vẫn đang phân vân về spdlite?
Một cú bấm sẽ gửi câu hỏi kèm trang này cho AI — xem AI nói gì về spdlite.