mirror of
https://github.com/tree-sitter/tree-sitter.git
synced 2026-09-10 07:36:22 -04:00
23 lines
442 B
C++
23 lines
442 B
C++
#include "helpers/spy_logger.h"
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
using std::string;
|
|
using std::vector;
|
|
|
|
static void spy_log(void *data, TSLogType type, const char *msg) {
|
|
SpyLogger *logger = static_cast<SpyLogger *>(data);
|
|
logger->messages.push_back(msg);
|
|
}
|
|
|
|
TSLogger SpyLogger::logger() {
|
|
TSLogger result;
|
|
result.payload = (void *)this;
|
|
result.log = spy_log;
|
|
return result;
|
|
}
|
|
|
|
void SpyLogger::clear() {
|
|
messages.clear();
|
|
}
|