Beispiel #1
0
void Log::write(Log::debugLevelType debug_level, const char* str, ...)
{
	if(log_file && (debug_level<=MAXIMUM_DEBUG_LEVEL)){

		char buffer[256];
		va_list args;

		va_start(args,str);
		vsprintf(buffer,str,args);
		va_end(args);

		char timestamp[9];
		generateTimestamp(timestamp, 9);

		fputs(timestamp, log_file);
		fputs("\t", log_file);
		fputs(buffer, log_file);
		fputs("\n", log_file);
		fflush(log_file);

		if(PRINT_TO_DS) {
			switch(debug_level) {
			case Log::ERROR_LEVEL:
				DriverStation::ReportError(buffer);
				break;
			case Log::WARNING_LEVEL:
				DriverStation::ReportWarning(buffer);
				break;
			default:
				DriverStation::ReportWarning(buffer);
				break;
			}
		}
	}
}
Beispiel #2
0
    /* static */
    Request* Request::fromConsumerAndToken(
                                            Consumer consumer,
                                            Token token,
                                            QString url,
                                            Method method,
                                            QMap<QString, QString> *parameters,
                                            QObject *parent)
    {
        QMap<QString, QString> defaultParameters;
        defaultParameters.insert(QString("oauth_version"), VERSION);
        defaultParameters.insert(QString("oauth_nonce"), generateNonce());
        defaultParameters.insert(QString("oauth_timestamp"), generateTimestamp());
        defaultParameters.insert(QString("oauth_consumer_key"), consumer.getKey());

        if (token.getKey().length() > 0) {
            defaultParameters.insert(QString("oauth_token"), token.getKey());
        }

        if (parameters != 0) {
            QMapIterator<QString, QString> it(*parameters);
            while (it.hasNext()) {
                it.next();
                defaultParameters.insert(it.key(), it.value());
            }
        }

        return new Request(method, url, &defaultParameters, parent);
    }
Beispiel #3
0
std::string generateTimestampForFilename()
{
    return generateTimestamp("%Y-%m-%d_%H_%M_%S");
}
Beispiel #4
0
std::string generateTimestamp()
{
    return generateTimestamp("%Y-%m-%d %H %M %S");
}