forked from mltframework/shotcut
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAndroidAppender.cpp
More file actions
47 lines (37 loc) · 1.12 KB
/
AndroidAppender.cpp
File metadata and controls
47 lines (37 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
// Local
#include "AndroidAppender.h"
// Android
#include <android/log.h>
AndroidAppender::AndroidAppender()
{
setFormat(QLatin1String("<%{function}> %{message}\n"));
}
int AndroidAppender::androidLogPriority(Logger::LogLevel logLevel)
{
switch (logLevel)
{
case Logger::Trace:
return ANDROID_LOG_VERBOSE;
case Logger::Debug:
return ANDROID_LOG_DEBUG;
case Logger::Info:
return ANDROID_LOG_INFO;
case Logger::Warning:
return ANDROID_LOG_WARN;
case Logger::Error:
return ANDROID_LOG_ERROR;
case Logger::Fatal:
return ANDROID_LOG_FATAL;
}
// Just in case
return ANDROID_LOG_DEFAULT;
}
void AndroidAppender::append(const QDateTime& timeStamp, Logger::LogLevel logLevel, const char* file, int line,
const char* function, const QString& category, const QString& message)
{
QString msg = formattedString(timeStamp, logLevel, file, line, function, category, message);
QString cat = category;
if (cat.isEmpty())
cat = QLatin1String("Logger");
__android_log_write(androidLogPriority(logLevel), qPrintable(cat), qPrintable(msg));
}