ViewVC Help
View File | Revision Log | View Changeset | Root Listing
root/Oni2/s10k/CommonLibs/plog/Appenders/AndroidAppender.h
Revision: 1096
Committed: Sat Dec 30 14:40:33 2017 UTC (7 years, 9 months ago) by s10k
Content type: text/x-chdr
File size: 1159 byte(s)
Log Message:
Added zlib, quazip, basicxmlsyntaxhighlighter, conditionalsemaphore and linenumberdisplay libraries. zlib and quazip are pre-compiled, but you can compile them yourself, just delete the dll files (or equivalent binary files to your OS)

File Contents

# Content
1 #pragma once
2 #include <plog/Appenders/IAppender.h>
3 #include <android/log.h>
4
5 namespace plog
6 {
7 template<class Formatter>
8 class AndroidAppender : public IAppender
9 {
10 public:
11 AndroidAppender(const char* tag) : m_tag(tag)
12 {
13 }
14
15 virtual void write(const Record& record)
16 {
17 std::string str = Formatter::format(record);
18
19 __android_log_print(toPriority(record.getSeverity()), m_tag, "%s", str.c_str());
20 }
21
22 private:
23 static android_LogPriority toPriority(Severity severity)
24 {
25 switch (severity)
26 {
27 case fatal:
28 return ANDROID_LOG_FATAL;
29 case error:
30 return ANDROID_LOG_ERROR;
31 case warning:
32 return ANDROID_LOG_WARN;
33 case info:
34 return ANDROID_LOG_INFO;
35 case debug:
36 return ANDROID_LOG_DEBUG;
37 case verbose:
38 return ANDROID_LOG_VERBOSE;
39 default:
40 return ANDROID_LOG_UNKNOWN;
41 }
42 }
43
44 private:
45 const char* const m_tag;
46 };
47 }