common/logging.hpp¶
Logging facade — wraps spdlog directly.
Namespaces¶
| Name |
|---|
| sgns |
| sgns::neoswarm |
Types¶
| Name | |
|---|---|
| using std::shared_ptr< spdlog::logger > | Logger Logger sgns::base::Logger convention. |
Functions¶
| Name | |
|---|---|
| Logger | CreateLogger(const std::string & tag) Create a named logger for a NEO SWARM component. |
Types Documentation¶
using Logger¶
Logger sgns::base::Logger convention.
Functions Documentation¶
function CreateLogger¶
Create a named logger for a NEO SWARM component.
Parameters:
- tag Component name shown in log output (e.g. "Router", "P2PNode").
Return: Logger instance.
Source code¶
#ifndef NEOSWARM_COMMON_LOGGING_HPP
#define NEOSWARM_COMMON_LOGGING_HPP
#include <memory>
#include <spdlog/sinks/stdout_color_sinks.h>
#include <spdlog/spdlog.h>
#include <string>
namespace sgns::neoswarm
{
using Logger = std::shared_ptr<spdlog::logger>;
inline Logger CreateLogger( const std::string& tag )
{
const std::string name = "NeoSwarm/" + tag;
auto existing = spdlog::get( name );
if ( existing )
{
return existing;
}
auto logger = spdlog::stdout_color_mt( name );
logger->set_pattern( "[%Y-%m-%d %H:%M:%S.%e] [%^%l%$] [%n] %v" );
return logger;
}
} // namespace sgns::neoswarm
#endif // NEOSWARM_COMMON_LOGGING_HPP
Updated on 2026-07-25 at 22:56:57 +0000