下载资源后端资源详情
spdlog-1.x.zip
大小:340.7KB
价格:16积分
下载量:0
评分:
5.0
上传者:rainInSunny
更新日期:2024-09-04

C++日志库spdlog

资源文件列表(大概)

文件名
大小
spdlog-1.x/
-
spdlog-1.x/.clang-format
436B
spdlog-1.x/.clang-tidy
1.69KB
spdlog-1.x/.git-blame-ignore-revs
220B
spdlog-1.x/.gitattributes
13B
spdlog-1.x/.github/
-
spdlog-1.x/.github/workflows/
-
spdlog-1.x/.github/workflows/ci.yml
3.09KB
spdlog-1.x/.gitignore
1.11KB
spdlog-1.x/CMakeLists.txt
15.67KB
spdlog-1.x/INSTALL
1010B
spdlog-1.x/LICENSE
1.32KB
spdlog-1.x/README.md
17.75KB
spdlog-1.x/appveyor.yml
2.7KB
spdlog-1.x/bench/
-
spdlog-1.x/bench/CMakeLists.txt
1.25KB
spdlog-1.x/bench/async_bench.cpp
5.62KB
spdlog-1.x/bench/bench.cpp
9.3KB
spdlog-1.x/bench/formatter-bench.cpp
2.35KB
spdlog-1.x/bench/latency.cpp
9.3KB
spdlog-1.x/bench/utils.h
628B
spdlog-1.x/cmake/
-
spdlog-1.x/cmake/ide.cmake
1.16KB
spdlog-1.x/cmake/pch.h.in
5.24KB
spdlog-1.x/cmake/spdlog.pc.in
364B
spdlog-1.x/cmake/spdlogCPack.cmake
2.65KB
spdlog-1.x/cmake/spdlogConfig.cmake.in
550B
spdlog-1.x/cmake/utils.cmake
2.67KB
spdlog-1.x/cmake/version.rc.in
977B
spdlog-1.x/example/
-
spdlog-1.x/example/CMakeLists.txt
990B
spdlog-1.x/example/example.cpp
14.12KB
spdlog-1.x/include/
-
spdlog-1.x/include/spdlog/
-
spdlog-1.x/include/spdlog/async.h
3.93KB
spdlog-1.x/include/spdlog/async_logger-inl.h
2.91KB
spdlog-1.x/include/spdlog/async_logger.h
2.5KB
spdlog-1.x/include/spdlog/cfg/
-
spdlog-1.x/include/spdlog/cfg/argv.h
1.19KB
spdlog-1.x/include/spdlog/cfg/env.h
986B
spdlog-1.x/include/spdlog/cfg/helpers-inl.h
3.1KB
spdlog-1.x/include/spdlog/cfg/helpers.h
718B
spdlog-1.x/include/spdlog/common-inl.h
2KB
spdlog-1.x/include/spdlog/common.h
12.89KB
spdlog-1.x/include/spdlog/details/
-
spdlog-1.x/include/spdlog/details/backtracer-inl.h
1.96KB
spdlog-1.x/include/spdlog/details/backtracer.h
1.14KB
spdlog-1.x/include/spdlog/details/circular_q.h
3.3KB
spdlog-1.x/include/spdlog/details/console_globals.h
603B
spdlog-1.x/include/spdlog/details/file_helper-inl.h
4.6KB
spdlog-1.x/include/spdlog/details/file_helper.h
1.72KB
spdlog-1.x/include/spdlog/details/fmt_helper.h
4.37KB
spdlog-1.x/include/spdlog/details/log_msg-inl.h
1.36KB
spdlog-1.x/include/spdlog/details/log_msg.h
1.18KB
spdlog-1.x/include/spdlog/details/log_msg_buffer-inl.h
1.63KB
spdlog-1.x/include/spdlog/details/log_msg_buffer.h
935B
spdlog-1.x/include/spdlog/details/mpmc_blocking_q.h
5.16KB
spdlog-1.x/include/spdlog/details/null_mutex.h
930B
spdlog-1.x/include/spdlog/details/os-inl.h
17.79KB
spdlog-1.x/include/spdlog/details/os.h
3.83KB
spdlog-1.x/include/spdlog/details/periodic_worker-inl.h
620B
spdlog-1.x/include/spdlog/details/periodic_worker.h
1.77KB
spdlog-1.x/include/spdlog/details/registry-inl.h
8.35KB
spdlog-1.x/include/spdlog/details/registry.h
4.23KB
spdlog-1.x/include/spdlog/details/synchronous_factory.h
751B
spdlog-1.x/include/spdlog/details/tcp_client-windows.h
4.15KB
spdlog-1.x/include/spdlog/details/tcp_client.h
3.79KB
spdlog-1.x/include/spdlog/details/thread_pool-inl.h
4.4KB
spdlog-1.x/include/spdlog/details/thread_pool.h
3.83KB
spdlog-1.x/include/spdlog/details/udp_client-windows.h
3.06KB
spdlog-1.x/include/spdlog/details/udp_client.h
2.18KB
spdlog-1.x/include/spdlog/details/windows_include.h
188B
spdlog-1.x/include/spdlog/fmt/
-
spdlog-1.x/include/spdlog/fmt/bin_to_hex.h
7.21KB
spdlog-1.x/include/spdlog/fmt/bundled/
-
spdlog-1.x/include/spdlog/fmt/bundled/args.h
7.28KB
spdlog-1.x/include/spdlog/fmt/bundled/chrono.h
72.28KB
spdlog-1.x/include/spdlog/fmt/bundled/color.h
23.96KB
spdlog-1.x/include/spdlog/fmt/bundled/compile.h
18.53KB
spdlog-1.x/include/spdlog/fmt/bundled/core.h
97.59KB
spdlog-1.x/include/spdlog/fmt/bundled/fmt.license.rst
1.38KB
spdlog-1.x/include/spdlog/fmt/bundled/format-inl.h
71.92KB
spdlog-1.x/include/spdlog/fmt/bundled/format.h
160.73KB
spdlog-1.x/include/spdlog/fmt/bundled/locale.h
100B
spdlog-1.x/include/spdlog/fmt/bundled/os.h
12.98KB
spdlog-1.x/include/spdlog/fmt/bundled/ostream.h
7.13KB
spdlog-1.x/include/spdlog/fmt/bundled/printf.h
20.35KB
spdlog-1.x/include/spdlog/fmt/bundled/ranges.h
23.87KB
spdlog-1.x/include/spdlog/fmt/bundled/std.h
15.86KB
spdlog-1.x/include/spdlog/fmt/bundled/xchar.h
9.73KB
spdlog-1.x/include/spdlog/fmt/chrono.h
551B
spdlog-1.x/include/spdlog/fmt/compile.h
559B
spdlog-1.x/include/spdlog/fmt/fmt.h
825B
spdlog-1.x/include/spdlog/fmt/ostr.h
554B
spdlog-1.x/include/spdlog/fmt/ranges.h
551B
spdlog-1.x/include/spdlog/fmt/std.h
641B
spdlog-1.x/include/spdlog/fmt/xchar.h
548B
spdlog-1.x/include/spdlog/formatter.h
463B
spdlog-1.x/include/spdlog/fwd.h
305B
spdlog-1.x/include/spdlog/logger-inl.h
6.57KB
spdlog-1.x/include/spdlog/logger.h
13.1KB
spdlog-1.x/include/spdlog/mdc.h
1.33KB
spdlog-1.x/include/spdlog/pattern_formatter-inl.h
45.36KB
spdlog-1.x/include/spdlog/pattern_formatter.h
3.67KB
spdlog-1.x/include/spdlog/sinks/
-
spdlog-1.x/include/spdlog/sinks/android_sink.h
4.67KB
spdlog-1.x/include/spdlog/sinks/ansicolor_sink-inl.h
4.76KB
spdlog-1.x/include/spdlog/sinks/ansicolor_sink.h
3.88KB
spdlog-1.x/include/spdlog/sinks/base_sink-inl.h
1.77KB
spdlog-1.x/include/spdlog/sinks/base_sink.h
1.57KB
spdlog-1.x/include/spdlog/sinks/basic_file_sink-inl.h
1.19KB
spdlog-1.x/include/spdlog/sinks/basic_file_sink.h
2.24KB
spdlog-1.x/include/spdlog/sinks/callback_sink.h
1.67KB
spdlog-1.x/include/spdlog/sinks/daily_file_sink.h
9.23KB
spdlog-1.x/include/spdlog/sinks/dist_sink.h
2.32KB
spdlog-1.x/include/spdlog/sinks/dup_filter_sink.h
3.17KB
spdlog-1.x/include/spdlog/sinks/hourly_file_sink.h
6.95KB
spdlog-1.x/include/spdlog/sinks/kafka_sink.h
4.34KB
spdlog-1.x/include/spdlog/sinks/mongo_sink.h
3.91KB
spdlog-1.x/include/spdlog/sinks/msvc_sink.h
2KB
spdlog-1.x/include/spdlog/sinks/null_sink.h
1.21KB
spdlog-1.x/include/spdlog/sinks/ostream_sink.h
1.19KB
spdlog-1.x/include/spdlog/sinks/qt_sinks.h
12.12KB
spdlog-1.x/include/spdlog/sinks/ringbuffer_sink.h
2.03KB
spdlog-1.x/include/spdlog/sinks/rotating_file_sink-inl.h
4.82KB
spdlog-1.x/include/spdlog/sinks/rotating_file_sink.h
3.15KB
spdlog-1.x/include/spdlog/sinks/sink-inl.h
725B
spdlog-1.x/include/spdlog/sinks/sink.h
893B
spdlog-1.x/include/spdlog/sinks/stdout_color_sinks-inl.h
1.4KB
spdlog-1.x/include/spdlog/sinks/stdout_color_sinks.h
1.75KB
spdlog-1.x/include/spdlog/sinks/stdout_sinks-inl.h
4.25KB
spdlog-1.x/include/spdlog/sinks/stdout_sinks.h
2.37KB
spdlog-1.x/include/spdlog/sinks/syslog_sink.h
4.15KB
spdlog-1.x/include/spdlog/sinks/systemd_sink.h
4.76KB
spdlog-1.x/include/spdlog/sinks/tcp_sink.h
2.08KB
spdlog-1.x/include/spdlog/sinks/udp_sink.h
1.81KB
spdlog-1.x/include/spdlog/sinks/win_eventlog_sink.h
8.68KB
spdlog-1.x/include/spdlog/sinks/wincolor_sink-inl.h
6.88KB
spdlog-1.x/include/spdlog/sinks/wincolor_sink.h
2.65KB
spdlog-1.x/include/spdlog/spdlog-inl.h
3.04KB
spdlog-1.x/include/spdlog/spdlog.h
11.5KB
spdlog-1.x/include/spdlog/stopwatch.h
1.82KB
spdlog-1.x/include/spdlog/tweakme.h
6.21KB
spdlog-1.x/include/spdlog/version.h
417B
spdlog-1.x/logos/
-
spdlog-1.x/logos/jetbrains-variant-4.svg
4.62KB
spdlog-1.x/logos/spdlog.png
10.57KB
spdlog-1.x/scripts/
-
spdlog-1.x/scripts/ci_setup_clang.sh
226B
spdlog-1.x/scripts/extract_version.py
497B
spdlog-1.x/scripts/format.sh
630B
spdlog-1.x/src/
-
spdlog-1.x/src/async.cpp
398B
spdlog-1.x/src/bundled_fmtlib_format.cpp
1.56KB
spdlog-1.x/src/cfg.cpp
279B
spdlog-1.x/src/color_sinks.cpp
3.08KB
spdlog-1.x/src/file_sinks.cpp
801B
spdlog-1.x/src/spdlog.cpp
1.11KB
spdlog-1.x/src/stdout_sinks.cpp
1.97KB
spdlog-1.x/tests/
-
spdlog-1.x/tests/CMakeLists.txt
2.4KB
spdlog-1.x/tests/includes.h
987B
spdlog-1.x/tests/main.cpp
276B
spdlog-1.x/tests/test_async.cpp
8.79KB
spdlog-1.x/tests/test_backtrace.cpp
2.85KB
spdlog-1.x/tests/test_bin_to_hex.cpp
3.74KB
spdlog-1.x/tests/test_cfg.cpp
5.46KB
spdlog-1.x/tests/test_circular_q.cpp
1.01KB
spdlog-1.x/tests/test_create_dir.cpp
6.31KB
spdlog-1.x/tests/test_custom_callbacks.cpp
1.25KB
spdlog-1.x/tests/test_daily_logger.cpp
6.24KB
spdlog-1.x/tests/test_dup_filter.cpp
3KB
spdlog-1.x/tests/test_errors.cpp
4.27KB
spdlog-1.x/tests/test_eventlog.cpp
2.9KB
spdlog-1.x/tests/test_file_helper.cpp
7.09KB
spdlog-1.x/tests/test_file_logging.cpp
3.41KB
spdlog-1.x/tests/test_fmt_helper.cpp
1.98KB
spdlog-1.x/tests/test_macros.cpp
1.8KB
spdlog-1.x/tests/test_misc.cpp
6.57KB
spdlog-1.x/tests/test_mpmc_q.cpp
3.22KB
spdlog-1.x/tests/test_pattern_formatter.cpp
25.26KB
spdlog-1.x/tests/test_registry.cpp
4.24KB
spdlog-1.x/tests/test_sink.h
1.81KB
spdlog-1.x/tests/test_stdout_api.cpp
2.51KB
spdlog-1.x/tests/test_stopwatch.cpp
1.41KB
spdlog-1.x/tests/test_systemd.cpp
588B
spdlog-1.x/tests/test_time_point.cpp
1.42KB
spdlog-1.x/tests/utils.cpp
2.8KB
spdlog-1.x/tests/utils.h
451B

资源内容介绍

SPDLog 是一个高性能、灵活且易于使用的C++日志库,专为需要处理大量日志数据的现代应用程序设计。它采用高效的日志记录机制,旨在最小化对应用程序性能的影响,同时提供丰富的日志管理功能,如日志级别控制、异步写入、日志轮转、以及多种输出目的地(如文件、控制台、网络等)的支持。SPDLog 通过其优化的内部结构和简洁的API,使得在应用程序中集成和使用变得非常简单直观。无论是小型项目还是大型分布式系统,SPDLog 都能提供稳定可靠的日志解决方案,帮助开发者更好地追踪、调试和优化应用程序。
# spdlogVery fast, header-only/compiled, C++ logging library. [![ci](https://github.com/gabime/spdlog/actions/workflows/ci.yml/badge.svg)](https://github.com/gabime/spdlog/actions/workflows/ci.yml)&nbsp; [![Build status](https://ci.appveyor.com/api/projects/status/d2jnxclg20vd0o50?svg=true&branch=v1.x)](https://ci.appveyor.com/project/gabime/spdlog) [![Release](https://img.shields.io/github/release/gabime/spdlog.svg)](https://github.com/gabime/spdlog/releases/latest)## Install#### Header-only versionCopy the include [folder](https://github.com/gabime/spdlog/tree/v1.x/include/spdlog) to your build tree and use a C++11 compiler.#### Compiled version (recommended - much faster compile times)```console$ git clone https://github.com/gabime/spdlog.git$ cd spdlog && mkdir build && cd build$ cmake .. && make -j```see example [CMakeLists.txt](https://github.com/gabime/spdlog/blob/v1.x/example/CMakeLists.txt) on how to use.## Platforms* Linux, FreeBSD, OpenBSD, Solaris, AIX* Windows (msvc 2013+, cygwin)* macOS (clang 3.5+)* Android## Package managers:* Debian: `sudo apt install libspdlog-dev`* Homebrew: `brew install spdlog`* MacPorts: `sudo port install spdlog`* FreeBSD: `pkg install spdlog`* Fedora: `dnf install spdlog`* Gentoo: `emerge dev-libs/spdlog`* Arch Linux: `pacman -S spdlog`* openSUSE: `sudo zypper in spdlog-devel`* vcpkg: `vcpkg install spdlog`* conan: `spdlog/[>=1.4.1]`* conda: `conda install -c conda-forge spdlog`* build2: ```depends: spdlog ^1.8.2```## Features* Very fast (see [benchmarks](#benchmarks) below).* Headers only or compiled* Feature-rich formatting, using the excellent [fmt](https://github.com/fmtlib/fmt) library.* Asynchronous mode (optional)* [Custom](https://github.com/gabime/spdlog/wiki/3.-Custom-formatting) formatting.* Multi/Single threaded loggers.* Various log targets: * Rotating log files. * Daily log files. * Console logging (colors supported). * syslog. * Windows event log. * Windows debugger (```OutputDebugString(..)```). * Log to Qt widgets ([example](#log-to-qt-with-nice-colors)). * Easily [extendable](https://github.com/gabime/spdlog/wiki/4.-Sinks#implementing-your-own-sink) with custom log targets.* Log filtering - log levels can be modified at runtime as well as compile time.* Support for loading log levels from argv or environment var.* [Backtrace](#backtrace-support) support - store debug messages in a ring buffer and display them later on demand.## Usage samples#### Basic usage```c++#include "spdlog/spdlog.h"int main() { spdlog::info("Welcome to spdlog!"); spdlog::error("Some error message with arg: {}", 1); spdlog::warn("Easy padding in numbers like {:08d}", 12); spdlog::critical("Support for int: {0:d}; hex: {0:x}; oct: {0:o}; bin: {0:b}", 42); spdlog::info("Support for floats {:03.2f}", 1.23456); spdlog::info("Positional args are {1} {0}..", "too", "supported"); spdlog::info("{:<30}", "left aligned"); spdlog::set_level(spdlog::level::debug); // Set global log level to debug spdlog::debug("This message should be displayed.."); // change log pattern spdlog::set_pattern("[%H:%M:%S %z] [%n] [%^---%L---%$] [thread %t] %v"); // Compile time log levels // Note that this does not change the current log level, it will only // remove (depending on SPDLOG_ACTIVE_LEVEL) the call on the release code. SPDLOG_TRACE("Some trace message with param {}", 42); SPDLOG_DEBUG("Some debug message");}```---#### Create stdout/stderr logger object```c++#include "spdlog/spdlog.h"#include "spdlog/sinks/stdout_color_sinks.h"void stdout_example(){ // create a color multi-threaded logger auto console = spdlog::stdout_color_mt("console"); auto err_logger = spdlog::stderr_color_mt("stderr"); spdlog::get("console")->info("loggers can be retrieved from a global registry using the spdlog::get(logger_name)");}```---#### Basic file logger```c++#include "spdlog/sinks/basic_file_sink.h"void basic_logfile_example(){ try { auto logger = spdlog::basic_logger_mt("basic_logger", "logs/basic-log.txt"); } catch (const spdlog::spdlog_ex &ex) { std::cout << "Log init failed: " << ex.what() << std::endl; }}```---#### Rotating files```c++#include "spdlog/sinks/rotating_file_sink.h"void rotating_example(){ // Create a file rotating logger with 5 MB size max and 3 rotated files auto max_size = 1048576 * 5; auto max_files = 3; auto logger = spdlog::rotating_logger_mt("some_logger_name", "logs/rotating.txt", max_size, max_files);}```---#### Daily files```c++#include "spdlog/sinks/daily_file_sink.h"void daily_example(){ // Create a daily logger - a new file is created every day at 2:30 am auto logger = spdlog::daily_logger_mt("daily_logger", "logs/daily.txt", 2, 30);}```---#### Backtrace support```c++// Debug messages can be stored in a ring buffer instead of being logged immediately.// This is useful to display debug logs only when needed (e.g. when an error happens).// When needed, call dump_backtrace() to dump them to your log.spdlog::enable_backtrace(32); // Store the latest 32 messages in a buffer. // or my_logger->enable_backtrace(32)..for(int i = 0; i < 100; i++){ spdlog::debug("Backtrace message {}", i); // not logged yet..}// e.g. if some error happened:spdlog::dump_backtrace(); // log them now! show the last 32 messages// or my_logger->dump_backtrace(32)..```---#### Periodic flush```c++// periodically flush all *registered* loggers every 3 seconds:// warning: only use if all your loggers are thread-safe ("_mt" loggers)spdlog::flush_every(std::chrono::seconds(3));```---#### Stopwatch```c++// Stopwatch support for spdlog#include "spdlog/stopwatch.h"void stopwatch_example(){ spdlog::stopwatch sw; spdlog::debug("Elapsed {}", sw); spdlog::debug("Elapsed {:.3}", sw); }```---#### Log binary data in hex```c++// many types of std::container<char> types can be used.// ranges are supported too.// format flags:// {:X} - print in uppercase.// {:s} - don't separate each byte with space.// {:p} - don't print the position on each line start.// {:n} - don't split the output into lines.// {:a} - show ASCII if :n is not set.#include "spdlog/fmt/bin_to_hex.h"void binary_example(){ auto console = spdlog::get("console"); std::array<char, 80> buf; console->info("Binary example: {}", spdlog::to_hex(buf)); console->info("Another binary example:{:n}", spdlog::to_hex(std::begin(buf), std::begin(buf) + 10)); // more examples: // logger->info("uppercase: {:X}", spdlog::to_hex(buf)); // logger->info("uppercase, no delimiters: {:Xs}", spdlog::to_hex(buf)); // logger->info("uppercase, no delimiters, no position info: {:Xsp}", spdlog::to_hex(buf));}```---#### Logger with multi sinks - each with a different format and log level```c++// create a logger with 2 targets, with different log levels and formats.// The console will show only warnings or errors, while the file will log all.void multi_sink_example(){ auto console_sink = std::make_shared<spdlog::sinks::stdout_color_sink_mt>(); console_sink->set_level(spdlog::level::warn); console_sink->set_pattern("[multi_sink_example] [%^%l%$] %v"); auto file_sink = std::make_shared<spdlog::sinks::basic_file_sink_mt>("logs/multisink.txt", true); file_sink->set_level(spdlog::level::trace); spdlog::logger logger("multi_sink", {console_sink, file_sink}); logger.set_level(spdlog::level::debug); logger.warn("this should appear in both console and file"); logger.info("this message sho

用户评论 (0)

发表评论

captcha