Skip to content

JayTwoLab/spdlog-asio

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

spdlog-asio

spdlog-asio is a lightweight C++ logging sink that integrates spdlog with Boost.Asio for TCP-based log message transmission.

Features

  • Simple integration of spdlog and Boost.Asio
  • Send logs over TCP to a remote server
  • Easy to plug into existing spdlog setups

Example Usage

auto logger = std::make_shared<spdlog::logger>(
 "tcp_asio_logger",
 std::make_shared<tcp_asio_sink<std::mutex>>("127.0.0.1", 9000));
spdlog::register_logger(logger);

// Log a message to the TCP server
logger->info("spdlog + boost::asio TCP logging test!");
log_tcp_asio_logger(
   "file name: {}, size: {} byte(s)", // fmt type
   "example.txt", 2345 );

Requirements

  • C++17 or later
  • Boost (system, asio)
  • spdlog

Installation

Ubuntu

sudo apt update
sudo apt install libspdlog-dev libboost-dev libboost-system-dev

CentOS / Red Hat

sudo dnf install epel-release spdlog-devel boost-devel

Project Files

  • main.cpp: Example application that sends logs to a TCP server.
  • recv.py: Python-based TCP server for receiving log messages.
  • CMakeLists.txt: Build configuration using CMake.

License

MIT License


GitHub Repository: https://github.com/JayTwoLab/spdlog-asio

About

spdlog with boost.asio

Resources

License

Stars

Watchers

Forks

Packages

No packages published