2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 06:35:14 +00:00

Use LOG/DEBUG_LOG from lib_base.

This commit is contained in:
John Preston
2021-04-20 16:40:54 +04:00
parent 08e170a068
commit c360bb9da4
12 changed files with 65 additions and 87 deletions

View File

@@ -323,11 +323,6 @@ bool DebugEnabled() {
#endif
}
QString ProfilePrefix() {
const auto now = crl::profile();
return '[' + QString::number(now / 1000., 'f', 3) + "] ";
}
void start(not_null<Core::Launcher*> launcher) {
Assert(LogsData == nullptr);
@@ -527,29 +522,21 @@ void writeMain(const QString &v) {
struct tm tm;
mylocaltime(&tm, &t);
QString msg(QString("[%1.%2.%3 %4:%5:%6] %7\n").arg(tm.tm_year + 1900).arg(tm.tm_mon + 1, 2, 10, QChar('0')).arg(tm.tm_mday, 2, 10, QChar('0')).arg(tm.tm_hour, 2, 10, QChar('0')).arg(tm.tm_min, 2, 10, QChar('0')).arg(tm.tm_sec, 2, 10, QChar('0')).arg(v));
const auto msg = QString("[%1.%2.%3 %4:%5:%6] %7\n"
).arg(tm.tm_year + 1900
).arg(tm.tm_mon + 1, 2, 10, QChar('0')
).arg(tm.tm_mday, 2, 10, QChar('0')
).arg(tm.tm_hour, 2, 10, QChar('0')
).arg(tm.tm_min, 2, 10, QChar('0')
).arg(tm.tm_sec, 2, 10, QChar('0')
).arg(v);
_logsWrite(LogDataMain, msg);
QString debugmsg(QString("%1 %2\n").arg(_logsEntryStart(), v));
_logsWrite(LogDataDebug, debugmsg);
writeDebug(v);
}
void writeDebug(const char *file, int32 line, const QString &v) {
const char *last = strstr(file, "/"), *found = 0;
while (last) {
found = last;
last = strstr(last + 1, "/");
}
last = strstr(file, "\\");
while (last) {
found = last;
last = strstr(last + 1, "\\");
}
if (found) {
file = found + 1;
}
QString msg(QString("%1 %2 (%3 : %4)\n").arg(_logsEntryStart(), v, file, QString::number(line)));
void writeDebug(const QString &v) {
const auto msg = QString("%1 %2\n").arg(_logsEntryStart(), v);
_logsWrite(LogDataDebug, msg);
#ifdef Q_OS_WIN
@@ -562,12 +549,15 @@ void writeDebug(const char *file, int32 line, const QString &v) {
}
void writeTcp(const QString &v) {
QString msg(QString("%1 %2\n").arg(_logsEntryStart(), v));
const auto msg = QString("%1 %2\n").arg(_logsEntryStart(), v);
_logsWrite(LogDataTcp, msg);
}
void writeMtp(int32 dc, const QString &v) {
QString msg(QString("%1 (dc:%2) %3\n").arg(_logsEntryStart()).arg(dc).arg(v));
const auto msg = QString("%1 (dc:%2) %3\n").arg(
_logsEntryStart(),
QString::number(dc),
v);
_logsWrite(LogDataMtp, msg);
}