Improve logging to telegram
This commit is contained in:
29
jenkinsfiles/WTLPokalUpdater/Jenkinsfile
vendored
29
jenkinsfiles/WTLPokalUpdater/Jenkinsfile
vendored
@@ -42,8 +42,9 @@ pipeline {
|
||||
}
|
||||
}
|
||||
if(errorOutput != "") {
|
||||
errorOutput = clean(errorOutput)
|
||||
errorOutput.split('\n').toList().unique().each {
|
||||
ArrayList<String> outputList = outputString.replace("\n\n", "\n").split('\n').toList()
|
||||
outputList = clean(outputList)
|
||||
outputList.each {
|
||||
telegramSendManual(it)
|
||||
}
|
||||
}
|
||||
@@ -65,19 +66,19 @@ pipeline {
|
||||
}
|
||||
}
|
||||
|
||||
private String clean(String orig) {
|
||||
orig = orig.replace("\n\n", "\n")
|
||||
while(orig.indexOf(" [main] INFO de.jeyp91 - ") > 0) {
|
||||
int index = orig.indexOf(" [main] INFO de.jeyp91 - ")
|
||||
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)
|
||||
}
|
||||
while(orig.indexOf(" [main] ERROR de.jeyp91 - ") > 0) {
|
||||
int index = orig.indexOf(" [main] ERROR de.jeyp91 - ")
|
||||
String newString = orig.substring(0, index-12) + orig.substring(index+31, orig.size())
|
||||
orig = newString
|
||||
}
|
||||
return orig
|
||||
return cleaned.unique()
|
||||
}
|
||||
|
||||
def telegramSendManual(String text) {
|
||||
|
||||
Reference in New Issue
Block a user