forked from baritonehands/jenkinsnuget
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FIXED JENKINS-38022] Create a verbose logging option for Nuget trigger
- Loading branch information
Showing
11 changed files
with
189 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
79 changes: 79 additions & 0 deletions
79
src/main/java/org/jenkinsci/plugins/nuget/triggers/logs/InfoTriggerLog.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
package org.jenkinsci.plugins.nuget.triggers.logs; | ||
|
||
import hudson.model.TaskListener; | ||
import org.jenkinsci.lib.xtrigger.XTriggerLog; | ||
import org.xml.sax.SAXException; | ||
|
||
import java.io.IOException; | ||
import java.nio.file.Path; | ||
|
||
/** | ||
* @author Arnaud TAMAILLON | ||
*/ | ||
public class InfoTriggerLog implements TriggerLog { | ||
|
||
protected final XTriggerLog log; | ||
|
||
public InfoTriggerLog(XTriggerLog log) { | ||
this.log = log; | ||
} | ||
|
||
@Override | ||
public TaskListener getListener() { | ||
return log.getListener(); | ||
} | ||
|
||
@Override | ||
public void checkingPackageFile(Path packageFile) { | ||
log.info(String.format("Checking packages file: %s", packageFile.toAbsolutePath().toString())); | ||
} | ||
|
||
@Override | ||
public void packageHasBeenUpdated(String id, String version, String latest) { | ||
if (latest == null) { | ||
log.info(String.format("Package %s v%s: no version found.", id, version)); | ||
} else { | ||
log.info(String.format("Package %s v%s should update to v%s.", id, version, latest)); | ||
} | ||
} | ||
|
||
@Override | ||
public void errorWhileParsingPackageConfigFile(SAXException exception) { | ||
log.error(exception.toString()); | ||
} | ||
|
||
@Override | ||
public void errorVisitingFile(IOException exception) { | ||
log.error(exception.toString()); | ||
} | ||
|
||
@Override | ||
public void skippingFileWithNoFileName() { | ||
|
||
} | ||
|
||
@Override | ||
public void skippedFileNotPackagesConfig(Path fileName) { | ||
|
||
} | ||
|
||
@Override | ||
public void packageVersionRetrieved(String id, String latest) { | ||
|
||
} | ||
|
||
@Override | ||
public void reusingCachedPackageVersion(String id) { | ||
|
||
} | ||
|
||
@Override | ||
public void error(String s) { | ||
log.error(s); | ||
} | ||
|
||
@Override | ||
public void info(String s) { | ||
log.info(s); | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
src/main/java/org/jenkinsci/plugins/nuget/triggers/logs/TriggerLog.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package org.jenkinsci.plugins.nuget.triggers.logs; | ||
|
||
import hudson.model.TaskListener; | ||
import org.jenkinsci.lib.xtrigger.XTriggerLog; | ||
import org.xml.sax.SAXException; | ||
|
||
import java.io.IOException; | ||
import java.nio.file.Path; | ||
|
||
/** | ||
* @author Arnaud TAMAILLON | ||
*/ | ||
public interface TriggerLog { | ||
|
||
TaskListener getListener(); | ||
|
||
void checkingPackageFile(Path packageFile); | ||
void packageHasBeenUpdated(String id, String version, String latest); | ||
|
||
void errorWhileParsingPackageConfigFile(SAXException exception); | ||
void errorVisitingFile(IOException exc); | ||
|
||
void skippingFileWithNoFileName(); | ||
void skippedFileNotPackagesConfig(Path fileName); | ||
|
||
void packageVersionRetrieved(String id, String latest); | ||
void reusingCachedPackageVersion(String id); | ||
|
||
void error(String s); | ||
void info(String s); | ||
} | ||
|
39 changes: 39 additions & 0 deletions
39
src/main/java/org/jenkinsci/plugins/nuget/triggers/logs/VerboseTriggerLog.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package org.jenkinsci.plugins.nuget.triggers.logs; | ||
|
||
import org.jenkinsci.lib.xtrigger.XTriggerLog; | ||
|
||
import java.nio.file.Path; | ||
|
||
/** | ||
* @author Arnaud TAMAILLON | ||
*/ | ||
public class VerboseTriggerLog extends InfoTriggerLog { | ||
|
||
public VerboseTriggerLog(XTriggerLog log) { | ||
super(log); | ||
} | ||
|
||
@Override | ||
public void skippingFileWithNoFileName() { | ||
log.info("Skipped file (no file name can be retrieved)"); | ||
} | ||
|
||
@Override | ||
public void skippedFileNotPackagesConfig(Path fileName) { | ||
log.info(String.format("Skipped file (not packages.config): %s", fileName.toAbsolutePath().toString())); | ||
} | ||
|
||
@Override | ||
public void packageVersionRetrieved(String id, String latest) { | ||
if (latest == null) { | ||
log.info(String.format("Latest version for Package %s: no version found.", id)); | ||
} else { | ||
log.info(String.format("Latest version for Package %s is v%s.", id, latest)); } | ||
|
||
} | ||
|
||
@Override | ||
public void reusingCachedPackageVersion(String id) { | ||
log.info(String.format("Reusing cached version for Package %s.", id)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
src/main/resources/org/jenkinsci/plugins/nuget/triggers/NugetTrigger/config.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
Prerelease=Allow prerelease | ||
Prerelease=Allow prerelease | ||
VerboseLogs=Verbose Logs |
3 changes: 2 additions & 1 deletion
3
src/main/resources/org/jenkinsci/plugins/nuget/triggers/NugetTrigger/config_fr.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
Prerelease=Accepter les versions préliminaires | ||
Prerelease=Accepter les versions préliminaires | ||
VerboseLogs=Logs détaillés |