https://github.com/torchcs-mc/logger
TorchCS Logger is an extension of spdlog. It is generally used for console applications, such as bots or server software
https://github.com/torchcs-mc/logger
cmake cpp spdlog torchcs torchcs-logger wrapper
Last synced: 12 months ago
JSON representation
TorchCS Logger is an extension of spdlog. It is generally used for console applications, such as bots or server software
- Host: GitHub
- URL: https://github.com/torchcs-mc/logger
- Owner: TorchCS-MC
- License: mit
- Created: 2025-04-01T17:40:43.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-06-26T16:42:16.000Z (12 months ago)
- Last Synced: 2025-06-26T17:23:48.871Z (12 months ago)
- Topics: cmake, cpp, spdlog, torchcs, torchcs-logger, wrapper
- Language: C++
- Homepage:
- Size: 61.5 KB
- Stars: 2
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
## Description
TorchCS Logger is an extension of spdlog. It is generally used for console applications, such as bots or server software
## Required Tools
- **CMake 3.20+** (recommended)
- **A C++20 compiler:**
- **Windows:** MSVC (Visual Studio 2022) or MinGW
- **Linux:** GCC 11+ or Clang 14+
## CMake
```cmake
include(FetchContent)
FetchContent_Declare(
torchcs_logger
GIT_REPOSITORY https://github.com/TorchCS-MC/Logger.git
GIT_TAG [release_version]
)
FetchContent_MakeAvailable(torchcs_logger)
target_link_libraries(your_project PRIVATE torchcs::logger)
```
## Example Code
```c++
#include
#include
#include
#include
#include
#include
#include
int main() {
auto my_console_sink = std::make_shared();
auto file_sink = std::make_shared("logs/cool", 1024 * 1024 * 5);
std::vector> sinks = {my_console_sink, file_sink};
auto console_logger = std::make_shared("TorchCS", sinks.begin(), sinks.end());
console_logger->set_level(spdlog::level::trace);
torchcs::logger::SpdLogProvider provider(console_logger);
provider.setLevel(torchcs::logger::level::Type::Trace);
provider.log(torchcs::logger::level::Type::Info, torchcs::logger::color::Type::PINK + "Hello World");
provider.log(torchcs::logger::level::Type::Info, "§aHello World");
provider.log(torchcs::logger::level::Type::Debug, "Hello World");
provider.log(torchcs::logger::level::Type::Warn, "Hello World");
provider.log(torchcs::logger::level::Type::Error, "Hello World");
return 0;
}
```
## License
This project is licensed under the **MIT License**.
See the [LICENSE](LICENSE) file for more details.