1
0
Fork 0
mirror of https://github.com/ton-blockchain/ton synced 2025-03-09 15:40:10 +00:00

deleted unused code, support for logrotate, update in block validation code

This commit is contained in:
ton 2019-09-10 12:30:35 +04:00
parent 2b734e170c
commit 47814dca3d
44 changed files with 175 additions and 4196 deletions

View file

@ -50,7 +50,7 @@ class TsFileLog : public LogInterface {
private:
struct Info {
FileLog log;
bool is_inited;
std::atomic<bool> is_inited{false};
int id;
};
static constexpr int MAX_THREAD_ID = 128;
@ -59,7 +59,7 @@ class TsFileLog : public LogInterface {
LogInterface *get_current_logger() {
auto *info = get_current_info();
if (!info->is_inited) {
if (!info->is_inited.load(std::memory_order_relaxed)) {
CHECK(init_info(info).is_ok());
}
return &info->log;
@ -79,7 +79,15 @@ class TsFileLog : public LogInterface {
if (info->id == 0) {
return path_;
}
return PSTRING() << path_ << "." << info->id;
return PSTRING() << path_ << ".thread" << info->id << ".log";
}
void rotate() override {
for (auto &info : logs_) {
if (info.is_inited.load(std::memory_order_consume)) {
info.log.rotate();
}
}
}
};
} // namespace detail