JNILogger.h

00001 /*
00002  * @(#)JNILogger.h  0.2.0 / 2007-09-11
00003  *
00004  * Copyright (c) 2007, ETF and contributors. All rights reserved.
00005  *
00006  * This software is licensed under the LGPL, version 2.1, license.
00007  * A copy of the license is included in the file LICENSE-LGPL.txt.
00008  */
00009 #ifndef JNILOGGER_H
00010 #define JNILOGGER_H
00011 
00012 #include "JavaQxCommon.h"
00013 
00014 /*^**************************************************************************^*/
00015 /*- JNILogger Class.                                                         -*/
00016 /*^**************************************************************************^*/
00017 
00024 class JAVAQX_EXPORT JNILogger
00025 {
00026 public:
00027   static void logInfo(const char *message, const char *fileName,
00028                       int lineNumber);
00029   static void logInfo(const char *message);
00030   static void logWarning(const char *message, const char *fileName,
00031                          int lineNumber);
00032   static void logWarning(const char *message);
00033   static void logError(const char *message, const char *fileName,
00034                        int lineNumber);
00035   static void logError(const char *message);
00036 public:
00037   static void initialize(JNIEnv *env, jclass cls);
00038 private:
00039   static void log(int level, const char *message, const char *fileName,
00040                   int lineNumber);
00041 private:
00042   static jclass sm_loggerClass;
00043   static jmethodID sm_logMID;
00044 };
00045 
00046 /*^**************************************************************************^*/
00047 /*- JNILogger :: Macro Definitions.                                          -*/
00048 /*^**************************************************************************^*/
00049 
00050 #define LOG_INFO(message) JNILogger::logInfo(message, __FILE__, __LINE__)
00051 #define LOG_WARNING(message) JNILogger::logWarning(message, __FILE__, __LINE__)
00052 #define LOG_ERROR(message) JNILogger::logError(message, __FILE__, __LINE__)
00053 
00054 #endif // JNILOGGER_H
00055 
00056 /*^*****************************************************************************
00057   File History:
00058 
00059  - 2007-09-11 17:57:48 Slobodan
00060    Initial version
00061 
00062 *****************************************************************************^*/

Copyright © 2007 ETF and contributors. All Rights Reserved.