Exemple #1
0
/**
 * Report a message to the Logging service.  On the linux emulator
 * this will end up going to stdout.  On the Zaurus device it will
 * be written to a file.
 *
 * The <code>message</code> parameter is treated as a format
 * string to the standard C library call printf would be, with
 * conversion specifications (%s, %d, %c, etc) causing the
 * conversion and output of each successive argument after
 * <code>message</code>  As with printf, having a conversion
 * character in <code>message</code> without an associated argument
 * following it is an error.
 *
 * To ensure that no character in <code>message</code> is
 * interpreted as requiring conversion, a safe way to call
 * this method is:
 * <code> reportToLog(severity, chanID, "%s", message); </code>

 * @param severity severity level of report
 * @param channelID area report relates to, from midp_constants_data.h
 * @param message detail message to go with the report
 *                should not be NULL
 */
void
reportToLog(int severity, int channelID, char* message, ...) {
    va_list ap;

    if (!fChannelSetupDone) {
        /*
         * Get the system property to check if the specific
         * channels were set for logging.
         */
        const char* pChannelsArg = getSystemProperty(LOG_CHANNELS_ARG);

        if (pChannelsArg) {
            createLogChannelsList(pChannelsArg);
        }

        fChannelSetupDone = 1;
    }

    if (message != NULL && channelInList(channelID)) {
        midp_snprintf(gLoggingBuffer, LOGGING_BUFFER_SIZE,
                "REPORT: <level:%d> <channel:%d> ",
                severity,  channelID);
        pcsl_print(gLoggingBuffer);

        va_start(ap, message);

        midp_vsnprintf(gLoggingBuffer, LOGGING_BUFFER_SIZE, message, ap);
        pcsl_print(gLoggingBuffer);

        va_end(ap);

        pcsl_print("\n");
    }
}
void JVMSPI_PrintRaw(const char* s) {
#if ENABLE_PCSL && 0
  pcsl_print(s);
#else
  printf("%s", s);
#endif
}
void JVMSPI_PrintRaw(const char* s) {
#if ENABLE_PCSL
  pcsl_print(s);
#else
  jvm_printf("%s", s);
  jvm_fflush(stdout);
#endif
}
Exemple #4
0
static void report(char* message, ...){
  
    va_list ap;
    if (message != NULL) {

        va_start(ap, message);
        
#ifdef _WIN32
        _vsnprintf(buf, RPT_BUF_LEN, message, ap);
#else
        vsnprintf(buf, RPT_BUF_LEN, message, ap);
#endif
        pcsl_print(buf);
        
        va_end(ap);
    }
}
Exemple #5
0
/*
 * Unit test framework entry point for this set of unit tests.
 *
 */
void testPrint_runTests() {

    pcsl_print("This is a test\n");
    pcsl_print("This is a another test\n");

}