+#ifdef __ANDROID__
+static unsigned int level_to_android[] = {
+ ANDROID_LOG_INFO, // LL_NONE
+ //ANDROID_LOG_FATAL,
+ ANDROID_LOG_ERROR, // LL_ERROR
+ ANDROID_LOG_WARN, // LL_WARNING
+ ANDROID_LOG_WARN, // LL_ACTION
+ //ANDROID_LOG_INFO,
+ ANDROID_LOG_DEBUG, // LL_INFO
+ ANDROID_LOG_VERBOSE, // LL_VERBOSE
+
+};
+#endif
+
+////
+//// Globals
+////
+
+Logger g_logger;
+
+StreamLogOutput stdout_output(std::cout);
+StreamLogOutput stderr_output(std::cerr);
+std::ostream null_stream(NULL);
+
+RawLogBuffer raw_buf;
+
+LogBuffer none_buf(g_logger, LL_NONE);
+LogBuffer error_buf(g_logger, LL_ERROR);
+LogBuffer warning_buf(g_logger, LL_WARNING);
+LogBuffer action_buf(g_logger, LL_ACTION);
+LogBuffer info_buf(g_logger, LL_INFO);
+LogBuffer verbose_buf(g_logger, LL_VERBOSE);
+
+// Connection
+std::ostream *dout_con_ptr = &null_stream;
+std::ostream *derr_con_ptr = &verbosestream;
+
+// Server
+std::ostream *dout_server_ptr = &infostream;
+std::ostream *derr_server_ptr = &errorstream;
+
+#ifndef SERVER
+// Client
+std::ostream *dout_client_ptr = &infostream;
+std::ostream *derr_client_ptr = &errorstream;
+#endif
+
+std::ostream rawstream(&raw_buf);
+std::ostream dstream(&none_buf);
+std::ostream errorstream(&error_buf);
+std::ostream warningstream(&warning_buf);
+std::ostream actionstream(&action_buf);
+std::ostream infostream(&info_buf);
+std::ostream verbosestream(&verbose_buf);
+
+
+///////////////////////////////////////////////////////////////////////////////
+
+
+////
+//// Logger
+////