Correct feature names
[ACE_TAO.git] / ACE / ace / Log_Msg_Android_Logcat.cpp
blob2985965136ca172d57655181744c2f5d10034f07
1 #include "ace/config-all.h"
3 #ifdef ACE_ANDROID
5 #include <android/log.h> // Android Logging Functions
7 #include "ace/ACE.h"
8 #include "ace/Log_Category.h"
9 #include "ace/Log_Msg_Android_Logcat.h"
10 #include "ace/Log_Record.h"
11 #include "ace/OS_NS_string.h"
13 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
15 /**
16 * Convert ACE Log Priority to Android Logcat Priority
18 static android_LogPriority
19 convert_log_priority (ACE_Log_Priority lm_priority)
21 switch (lm_priority) {
22 case LM_TRACE:
23 case LM_DEBUG:
24 return ANDROID_LOG_DEBUG;
25 case LM_STARTUP:
26 case LM_SHUTDOWN:
27 case LM_INFO:
28 case LM_NOTICE:
29 return ANDROID_LOG_INFO;
30 case LM_WARNING:
31 return ANDROID_LOG_WARN;
32 case LM_CRITICAL:
33 case LM_ALERT:
34 case LM_EMERGENCY:
35 return ANDROID_LOG_FATAL;
36 case LM_ERROR:
37 default:
38 return ANDROID_LOG_ERROR;
42 ACE_Log_Msg_Android_Logcat::ACE_Log_Msg_Android_Logcat ()
46 ACE_Log_Msg_Android_Logcat::~ACE_Log_Msg_Android_Logcat (void)
48 this->close ();
51 int
52 ACE_Log_Msg_Android_Logcat::open (const ACE_TCHAR *)
54 return 0;
57 int
58 ACE_Log_Msg_Android_Logcat::reset (void)
60 return close ();
63 int
64 ACE_Log_Msg_Android_Logcat::close (void)
66 return 0;
69 ssize_t
70 ACE_Log_Msg_Android_Logcat::log (ACE_Log_Record &log_record)
72 __android_log_write (
73 convert_log_priority (static_cast<ACE_Log_Priority> (log_record.type ())),
74 "ACE",
75 log_record.msg_data ());
76 return 0;
79 ACE_END_VERSIONED_NAMESPACE_DECL
81 #endif