OLD | NEW |
| (Empty) |
1 /* | |
2 * This file is part of Adblock Plus <http://adblockplus.org/>, | |
3 * Copyright (C) 2006-2014 Eyeo GmbH | |
4 * | |
5 * Adblock Plus is free software: you can redistribute it and/or modify | |
6 * it under the terms of the GNU General Public License version 3 as | |
7 * published by the Free Software Foundation. | |
8 * | |
9 * Adblock Plus is distributed in the hope that it will be useful, | |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 * GNU General Public License for more details. | |
13 * | |
14 * You should have received a copy of the GNU General Public License | |
15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. | |
16 */ | |
17 | |
18 #include <android/log.h> | |
19 #include "AndroidLogSystem.h" | |
20 | |
21 void AndroidLogSystem::operator()(AdblockPlus::LogSystem::LogLevel logLevel, | |
22 const std::string& message, const std::string& source) | |
23 { | |
24 int lvl = ANDROID_LOG_DEFAULT; | |
25 switch (logLevel) | |
26 { | |
27 case LOG_LEVEL_TRACE: | |
28 lvl = ANDROID_LOG_VERBOSE; | |
29 break; | |
30 case LOG_LEVEL_LOG: | |
31 lvl = ANDROID_LOG_DEBUG; | |
32 break; | |
33 case LOG_LEVEL_INFO: | |
34 lvl = ANDROID_LOG_INFO; | |
35 break; | |
36 case LOG_LEVEL_WARN: | |
37 lvl = ANDROID_LOG_WARN; | |
38 break; | |
39 case LOG_LEVEL_ERROR: | |
40 lvl = ANDROID_LOG_ERROR; | |
41 break; | |
42 } | |
43 __android_log_print(lvl, "JS", "%s", message.c_str()); | |
44 if (source.size()) | |
45 { | |
46 __android_log_print(lvl, "JS", "\n"); | |
47 __android_log_print(lvl, "JS", " at "); | |
48 __android_log_print(lvl, "JS", "%s", source.c_str()); | |
49 } | |
50 __android_log_print(lvl, "JS", "\n"); | |
51 } | |
OLD | NEW |