All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.cloudfoundry.gradle.tasks.LogsCloudFoundryHelper.groovy Maven / Gradle / Ivy

Go to download

A Gradle plugin that makes it easy to deploy Gradle-based applications to Cloud Foundry instances.

The newest version!
package org.cloudfoundry.gradle.tasks

import org.cloudfoundry.client.lib.domain.ApplicationLog

class LogsCloudFoundryHelper {
    String formatLogEntry(ApplicationLog logEntry) {
        "${formatTimestamp(logEntry.timestamp)} ${formatSource(logEntry.sourceName, logEntry.sourceId)} ${formatType(logEntry.messageType)} ${logEntry.message}"
    }

    String formatTimestamp(Date timestamp) {
        timestamp.format("yyyy-MM-dd'T'HH:mm:ss.SSSZ")
    }

    String formatSource(String sourceName, String sourceId) {
        String source = sourceName
        if (source.equals("App")) {
            source += "/${sourceId}"
        }
        "[${source}]".padRight(10)
    }

    String formatType(def messageType) {
        messageType.toString() - 'STD'
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy