A C++ library for logging very fast and without allocating.
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 

16 行
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);
}
}