Improve logging to telegram
This commit is contained in:
24
jenkinsfiles/APIFootballUpdater/Jenkinsfile
vendored
24
jenkinsfiles/APIFootballUpdater/Jenkinsfile
vendored
@@ -21,8 +21,9 @@ pipeline {
|
||||
}
|
||||
String output = readFile 'log.txt'
|
||||
if(output != "") {
|
||||
output = clean(output)
|
||||
output.split('\n').each {
|
||||
ArrayList<String> outputList = outputString.replace("\n\n", "\n").split('\n').toList()
|
||||
outputList = clean(outputList)
|
||||
outputList.each {
|
||||
telegramSendManual(it)
|
||||
}
|
||||
}
|
||||
@@ -48,14 +49,19 @@ pipeline {
|
||||
}
|
||||
}
|
||||
|
||||
private String clean(String orig) {
|
||||
orig = orig.replace("\n\n", "\n")
|
||||
while(orig.indexOf(" [main] INFO de.jeyp91.App - ") > 0) {
|
||||
int index = orig.indexOf(" [main] INFO de.jeyp91.App - ")
|
||||
String newString = orig.substring(0, index-12) + orig.substring(index+30, orig.size())
|
||||
orig = newString
|
||||
private ArrayList<String> clean(ArrayList<String> orig) {
|
||||
ArrayList<String> cleaned = new ArrayList<String>()
|
||||
orig.each{line ->
|
||||
if(line.indexOf(" [main] INFO de.jeyp91 - ") >= 0) {
|
||||
line = line.substring(20, line.size())
|
||||
}
|
||||
|
||||
if(line.indexOf(" [main] ERROR de.jeyp91") >= 0) {
|
||||
line = line.substring(20, line.size())
|
||||
}
|
||||
cleaned.add(line)
|
||||
}
|
||||
return orig
|
||||
return cleaned.unique()
|
||||
}
|
||||
|
||||
def telegramSendManual(String text) {
|
||||
|
||||
Reference in New Issue
Block a user