Merge pull request #4630 from BrzVlad/feature-valloc-limit
[mono-project.git] / mono / utils / mono-log-android.c
blob1072788a6f5165885bbb8d15ec265449325cbbde
1 /**
2 * \file
3 * Android-specific interface to the logger
5 * This module contains the Android logcat logger interface
7 * Author:
8 * Marek Habersack <grendel@twistedcode.net>
11 #include <config.h>
13 #if defined (PLATFORM_ANDROID)
15 #include <android/log.h>
16 #include "mono-logger-internals.h"
18 /**
19 * mono_log_open_logcat:
20 * \param path Unused
21 * \param userData Unused
22 * Open access to Android logcat (no-op)
23 */
24 void
25 mono_log_open_logcat (const char *path, void *userData)
27 /* No-op on Android */
30 /**
31 * mono_log_write_logcat:
32 * \param domain Identifier string
33 * \param level Logging level flags
34 * \param format \c printf format string
35 * \param vargs Variable argument list
36 * Write data to Android logcat.
38 void
39 mono_log_write_logcat (const char *log_domain, GLogLevelFlags level, mono_bool hdr, const char *message)
41 android_LogPriority apriority;
43 switch (level & G_LOG_LEVEL_MASK)
45 case G_LOG_LEVEL_ERROR:
46 apriority = ANDROID_LOG_FATAL;
47 break;
49 case G_LOG_LEVEL_CRITICAL:
50 apriority = ANDROID_LOG_ERROR;
51 break;
53 case G_LOG_LEVEL_WARNING:
54 apriority = ANDROID_LOG_WARN;
55 break;
57 case G_LOG_LEVEL_MESSAGE:
58 apriority = ANDROID_LOG_INFO;
59 break;
61 case G_LOG_LEVEL_INFO:
62 apriority = ANDROID_LOG_DEBUG;
63 break;
65 case G_LOG_LEVEL_DEBUG:
66 apriority = ANDROID_LOG_VERBOSE;
67 break;
69 default:
70 apriority = ANDROID_LOG_UNKNOWN;
71 break;
74 __android_log_write (apriority, log_domain, message);
75 if (apriority == ANDROID_LOG_FATAL)
76 abort ();
79 /**
80 * mono_log_close_logcat
82 * Close access to Android logcat (no-op)
84 void
85 mono_log_close_logcat ()
87 /* No-op on Android */
89 #endif