zenilib  0.5.3.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Android.h
Go to the documentation of this file.
1 /* This file is part of the Zenipex Library (zenilib).
2  * Copyright (C) 2011 Mitchell Keith Bloch (bazald).
3  *
4  * zenilib is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * zenilib 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 Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public License
15  * along with zenilib. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef ZENI_ANDROID_H
19 #define ZENI_ANDROID_H
20 
21 #include <Zeni/String.h>
22 
23 #include <iostream>
24 #include <cstdio>
25 
26 #ifdef ANDROID
27 
28 #include <android/log.h>
29 inline void ZENI_LOGV(const Zeni::String &str) {
30  __android_log_print(ANDROID_LOG_VERBOSE, "zenilib App", "%s", str.c_str());
31 }
32 inline void ZENI_LOGD(const Zeni::String &str) {
33  __android_log_print(ANDROID_LOG_DEBUG , "zenilib App", "%s", str.c_str());
34 }
35 inline void ZENI_LOGI(const Zeni::String &str) {
36  __android_log_print(ANDROID_LOG_INFO , "zenilib App", "%s", str.c_str());
37 }
38 inline void ZENI_LOGW(const Zeni::String &str) {
39  __android_log_print(ANDROID_LOG_WARN , "zenilib App", "%s", str.c_str());
40 }
41 inline void ZENI_LOGE(const Zeni::String &str) {
42  __android_log_print(ANDROID_LOG_ERROR , "zenilib App", "%s", str.c_str());
43 }
44 
45 #else
46 
47 inline void ZENI_LOGV(const Zeni::String &str) {
48  std::cerr << "zenilib App Verbose : " << str << std::endl;
49 }
50 inline void ZENI_LOGD(const Zeni::String &str) {
51  std::cerr << "zenilib App Debug : " << str << std::endl;
52 }
53 inline void ZENI_LOGI(const Zeni::String &str) {
54  std::cerr << "zenilib App Info : " << str << std::endl;
55 }
56 inline void ZENI_LOGW(const Zeni::String &str) {
57  std::cerr << "zenilib App Warn : " << str << std::endl;
58 }
59 inline void ZENI_LOGE(const Zeni::String &str) {
60  std::cerr << "zenilib App Error : " << str << std::endl;
61 }
62 
63 #endif
64 
65 #endif
void ZENI_LOGV(const Zeni::String &str)
Definition: Android.h:47
const char * c_str() const
Definition: String.cpp:467
void ZENI_LOGW(const Zeni::String &str)
Definition: Android.h:56
void ZENI_LOGD(const Zeni::String &str)
Definition: Android.h:50
void ZENI_LOGE(const Zeni::String &str)
Definition: Android.h:59
void ZENI_LOGI(const Zeni::String &str)
Definition: Android.h:53
#define str(s)