Some checks failed
ZaStoGram source guards / guards (push) Failing after 37s
Build three ZaStoGram APKs / build (arm64-v8a, ZaStoGram-standalone-arm64-v8a, Arm64, arm64) (push) Failing after 2m48s
Build three ZaStoGram APKs / build (armeabi-v7a, ZaStoGram-standalone-armeabi-v7a, Armv7, armv7) (push) Failing after 2m50s
Build three ZaStoGram APKs / build (x86, ZaStoGram-standalone-x86, X86, x86) (push) Failing after 2m54s
Медиа-релей kwsN-1 уходил в туннель Cloudflare после первой неудачи и на 30 минут; на старте такая неудача почти неизбежна, а туннель на мобильной сети замерзает после ~16 КБ, и фото с DC1/DC5 не грузились. Медиа теперь подчиняется общим правилам (3 неудачи, 2 минуты), а туннель сам отключается, если его сессии замерзают на приёме. Лог: одна строка на контейнер вместо строки на каждое сообщение, без io_wait, erase request, messageId for token и быстрых поисков пути файла; итоговая строка wss_session на каждый сокет релея.
57 lines
1.8 KiB
C++
57 lines
1.8 KiB
C++
/*
|
|
* This is the source code of tgnet library v. 1.1
|
|
* It is licensed under GNU GPL v. 2 or later.
|
|
* You should have received a copy of the license in this archive (see LICENSE).
|
|
*
|
|
* Copyright Nikolai Kudashov, 2015-2018.
|
|
*/
|
|
|
|
#ifndef FILELOG_H
|
|
#define FILELOG_H
|
|
|
|
#include "Defines.h"
|
|
|
|
class FileLog {
|
|
public:
|
|
FileLog();
|
|
void init(std::string path);
|
|
static void fatal(const char *message, ...) __attribute__((format (printf, 1, 2)));
|
|
static void e(const char *message, ...) __attribute__((format (printf, 1, 2)));
|
|
static void w(const char *message, ...) __attribute__((format (printf, 1, 2)));
|
|
static void d(const char *message, ...) __attribute__((format (printf, 1, 2)));
|
|
static void ref(const char *message, ...) __attribute__((format (printf, 1, 2)));
|
|
static void delref(const char *message, ...) __attribute__((format (printf, 1, 2)));
|
|
|
|
static FileLog &getInstance();
|
|
|
|
private:
|
|
static void writeNativeLogLine(int androidPriority, const char *fileSeverity, const char *stdoutSeverity, const char *message, va_list args);
|
|
void rotateNativeLogIfNeededLocked();
|
|
FILE *logFile = nullptr;
|
|
std::string logPath;
|
|
size_t logBytesWritten = 0;
|
|
int64_t lastFlushMs = 0;
|
|
pthread_mutex_t mutex;
|
|
};
|
|
|
|
extern bool LOGS_ENABLED;
|
|
extern bool NETWORK_DEBUG_LOGS_ENABLED;
|
|
|
|
#define DEBUG_FATAL FileLog::getInstance().fatal
|
|
#define DEBUG_E FileLog::getInstance().e
|
|
#define DEBUG_W FileLog::getInstance().w
|
|
#define DEBUG_D FileLog::getInstance().d
|
|
|
|
// typeid(...).name() is mangled ("14TL_api_request"); logs only need the
|
|
// readable part. Returns a pointer into the same static string.
|
|
inline const char *logTypeName(const char *mangled) {
|
|
while (*mangled >= '0' && *mangled <= '9') {
|
|
++mangled;
|
|
}
|
|
return mangled;
|
|
}
|
|
|
|
#define DEBUG_REF FileLog::getInstance().ref
|
|
#define DEBUG_DELREF FileLog::getInstance().delref
|
|
|
|
#endif
|