static jboolean android_util_Log_isLoggable(JNIEnv* env, jobject clazz, jstring tag, jint level)
{
    if (tag == NULL) {
        return false;
    }

    const char* chars = env->GetStringUTFChars(tag, NULL);
    if (!chars) {
        return false;
    }

    jboolean result = false;
    if ((strlen(chars)+sizeof(LOG_NAMESPACE)) > PROPERTY_KEY_MAX) {
        char buf2[200];
        snprintf(buf2, sizeof(buf2), "Log tag \"%s\" exceeds limit of %zu characters\n",
                chars, PROPERTY_KEY_MAX - sizeof(LOG_NAMESPACE));

        jniThrowException(env, "java/lang/IllegalArgumentException", buf2);
    } else {
        result = isLoggable(chars, level);
    }

    env->ReleaseStringUTFChars(tag, chars);
    return result;
}
Ejemplo n.º 2
0
void winLog::developer(const char*  msg, ...) {
    if (isLoggable(LOG_LEVEL_INFO)) {
        va_list argList;
        va_start (argList, msg);
        printMessage(LOG_DEBUG, msg, argList);
        va_end(argList);
    }
}
Ejemplo n.º 3
0
SensordLogger::~SensordLogger()
{
    if (!initialized || !isLoggable(currentLevel))
        return;

    printToTarget(oss->str().c_str());
    delete oss;
}
Ejemplo n.º 4
0
void SymbianLog::developer(const char*  msg, ...) 
{
    if (isLoggable(LOG_LEVEL_INFO)) {
        PLATFORM_VA_LIST argList;
        PLATFORM_VA_START (argList, msg);
        printMessage(LOG_DEBUG, msg, argList);
        PLATFORM_VA_END(argList);
    }
}
Ejemplo n.º 5
0
SensordLogger::SensordLogger (const char* func, const char *file, int line, SensordLogLevel level) :
    oss(0),
    currentLevel(level)
{
    if (!initialized || !isLoggable(level))
        return;
    oss = new std::ostringstream();
    *oss << logLevelToText(level);
    *oss << "[" << file << ":" << line << ":" << func << "]: ";
}
Ejemplo n.º 6
0
 void JSocketHandler::publish(JLogRecord* record) {
     lock();
     if (!isLoggable(record)) {
         unlock();
         return;
     }
     JStreamHandler::publish(record);
     flush();
     unlock();
 }
Ejemplo n.º 7
0
DebuggingStream::~DebuggingStream()
{
#if DEBUGGING_ENABLED
  if ( isLoggable() ) {
    switch (m_level) {
      case ERRORS: std::cout << "ERROR: "; break;
      case WARNINGS: std::cout << "WARNING: "; break;
      case DEBUGGING: std::cout << "DEBUG: "; break;
      case INFORMATIVE: std::cout << "INFO: "; break;
      default: break;
    }
    std::cout << m_buffer << "\n";
  }
#endif
}
Ejemplo n.º 8
0
void Logger::log(const Level& level, std::string message, bool addRC) const {
    if (isLoggable(level)) {
        LogRecord* lr = new LogRecord(level, message, _name);
# if defined(__linux) || defined(__unix) || defined(__APPLE__)
        pthread_mutex_lock(&Logger::lock);
#endif
        if (onRecord != NULL) {
            onRecord(lr);
            delete lr;
        } else {
            Logger::logWrite(lr->toString(), addRC);
            delete lr;
        }
# if defined(__linux) || defined(__unix) || defined(__APPLE__)
        pthread_mutex_unlock(&Logger::lock);
#endif
    }
}
bool android_util_Log_isVerboseLogEnabled(const char* tag) {
    return isLoggable(tag, levels.verbose);
}
Ejemplo n.º 10
0
 /**
  * @brief Member function <b>shouldPrint</b> returns true if the line should print.
  *
  * @param line_mask    a <b>PrintMask</b> value of the line mask.
  *
  * @return      a <b>bool</b> of true if this line should be printed.
  */
 bool shouldPrint(PrintMask line_mask) {
   return isEnabled() && isLoggable(line_mask);
 }