A C++ library for logging very fast and without allocating.
25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

16 lines
360 B

#include <span>
#include "sl/logger.h"
#include "registry.h"
namespace sl {
void log(int log_id, std::string line) {
auto& slab = registry_map.at(log_id);
auto token = slab.reserve_write(line.size());
auto span = slab.get_buffer(token);
for(auto elem : line) {
span.front() = elem;
span = span.subspan(1);
}
slab.conclude_write(token);
}
}