29 #include <com/avpkit/ferry/Ferry.h>
30 #include <com/avpkit/ferry/Mutex.h>
32 namespace com {
namespace avpkit {
namespace ferry {
69 static Logger* getLogger(
const char *aLoggerName);
81 static Logger* getStaticLogger(
const char *aLoggerName);
94 bool log(
const char* filename,
int lineNo, Level level,
const char *format, ...);
96 bool logVA(
const char* filename,
int lineNo, Level level,
const char *format, va_list ap);
102 bool error(
const char* filename,
int lineNo,
const char* format, ...);
103 bool warn(
const char* filename,
int lineNo,
const char* format, ...);
104 bool info(
const char* filename,
int lineNo,
const char* format, ...);
105 bool debug(
const char* filename,
int lineNo,
const char* format, ...);
106 bool trace(
const char* filename,
int lineNo,
const char* format, ...);
109 bool isLogging(Level level);
110 void setIsLogging(Level level,
bool value);
111 static bool isGlobalLogging(Level level);
112 static void setGlobalIsLogging(Level level,
bool value);
113 const char * getName();
118 Logger(
const char* loggerName, jobject aJavaLogger);
121 static void initJavaBindings(JavaVM* vm,
void* closure);
122 static bool mInitialized;
123 static void shutdownJavaBindings(JavaVM* vm,
void* closure);
129 static const int cMaxLogMessageLength=16384;
130 static const int cMaxLoggerNameLength=255;
131 char mLoggerName[cMaxLoggerNameLength+1];
134 bool doLog(Level level,
const char*msg);
135 bool doNativeLog(Level level,
const char *msg);
136 bool doJavaLog(Level level,
const char* msg);
139 static jclass mClass;
140 static jmethodID mGetLoggerMethod;
141 static jmethodID mLogMethod;
143 static Mutex *mClassMutex;
144 static bool mGlobalIsLogging[5];
151 #ifndef VS_CPP_PACKAGE
152 #define VS_CPP_PACKAGE native.__FILE
175 #define VS_TOSTRING( S ) #S
177 #define VS_LOG_SETUP( LOGGERNAME ) \
178 static com::avpkit::ferry::Logger* vs_logger_static_context( \
179 com::avpkit::ferry::Logger::getStaticLogger( VS_TOSTRING( LOGGERNAME ) ) )
181 #define VS_LOG_ERROR(...) \
182 (void) vs_logger_static_context->error(__FILE__, __LINE__, __VA_ARGS__)
184 #define VS_LOG_WARN(...) \
185 (void) vs_logger_static_context->warn(__FILE__, __LINE__, __VA_ARGS__)
187 #define VS_LOG_INFO(...) \
188 (void) vs_logger_static_context->info(__FILE__, __LINE__, __VA_ARGS__)
190 #define VS_LOG_DEBUG(...) \
191 (void) vs_logger_static_context->debug(__FILE__, __LINE__, __VA_ARGS__)
193 #define VS_LOG_TRACE(...) \
194 (void) vs_logger_static_context->trace(__FILE__, __LINE__, __VA_ARGS__)
197 #define VS_ASSERT( expr , msg ) \
200 VS_LOG_ERROR("!!!ASSERTION FAILED!!! \"" VS_TOSTRING (expr) "\" with message \"%s\"", msg); \
206 #define VS_ASSERT( expr, msg ) (void) vs_logger_static_context;
223 #ifdef VS_LOG_LOGLEVELS_NONE
229 #define VS_LOG_ERROR(...) do {} while(0)
230 #define VS_LOG_WARN(...) do {} while(0)
231 #define VS_LOG_INFO(...) do {} while(0)
232 #define VS_LOG_DEBUG(...) do {} while(0)
233 #define VS_LOG_TRACE(...) do {} while(0)
235 #ifdef VS_LOG_LOGLEVELS_ERROR
240 #define VS_LOG_WARN(...) do {} while(0)
241 #define VS_LOG_INFO(...) do {} while(0)
242 #define VS_LOG_DEBUG(...) do {} while(0)
243 #define VS_LOG_TRACE(...) do {} while(0)
245 #ifdef VS_LOG_LOGLEVELS_WARN
249 #define VS_LOG_INFO(...) do {} while(0)
250 #define VS_LOG_DEBUG(...) do {} while(0)
251 #define VS_LOG_TRACE(...) do {} while(0)
253 #ifdef VS_LOG_LOGLEVELS_INFO
256 #define VS_LOG_DEBUG(...) do {} while(0)
257 #define VS_LOG_TRACE(...) do {} while(0)
259 #ifdef VS_LOG_LOGLEVELS_DEBUG
261 #define VS_LOG_TRACE(...) do {} while(0)
263 #ifdef VS_LOG_LOGLEVELS_ALL
267 #define VS_LOG_TRACE(...) do {} while(0)
Level
Different logging levels (noiseness) supported by us.
WARNING: Do not use logging in this class, and do not set any static file variables to values other t...