@@ -28,6 +28,7 @@ type options struct {
2828 dryRun bool
2929 github prowflagutil.GitHubOptions
3030 hmacSecret string
31+ logLevel string
3132}
3233
3334func newOptions () * options {
@@ -36,6 +37,7 @@ func newOptions() *options {
3637 fs .IntVar (& o .port , "port" , 8080 , "Port to listen to." )
3738 fs .BoolVar (& o .dryRun , "dry-run" , false , "Dry run for testing (uses API tokens but does not mutate)." )
3839 fs .StringVar (& o .hmacSecret , "hmac" , "/etc/webhook/hmac" , "Path to the file containing the GitHub HMAC secret." )
40+ fs .StringVar (& o .logLevel , "log-level" , "debug" , "Application log level" )
3941
4042 for _ , group := range []flagutil.OptionGroup {& o .github } {
4143 group .AddFlags (fs )
@@ -56,7 +58,7 @@ func main() {
5658 o := newOptions ()
5759
5860 logrus .SetFormatter (& logrus.JSONFormatter {})
59- logrus .SetLevel ( logrus . DebugLevel )
61+ logrus .ParseLevel ( o . logLevel )
6062 log := logrus .StandardLogger ().WithField ("plugin" , pluginName )
6163
6264 secretAgent := & secret.Agent {}
@@ -92,14 +94,12 @@ func main() {
9294func (s * server ) markDeployedPR (w http.ResponseWriter , req * http.Request ) {
9395 var commitSHA string
9496 var team string
95-
9697 for k , v := range req .URL .Query () {
9798 switch k {
9899 case "commit" :
99100 commitSHA = v [0 ]
100101 case "team" :
101102 team = v [0 ]
102-
103103 default :
104104 s .log .Warnf ("Unrecognized parameter received: %s" , k )
105105 }
@@ -240,7 +240,7 @@ func (s *server) updatePullRequests(prs []pullRequest, team string) (teamDeploye
240240 errs = append (errs , err )
241241 }
242242 } else {
243- s .log .Debugf ("PR %v already has label %v" , pr .Number , labelDeployed )
243+ s .log .Infof ("PR %v already has label %v" , pr .Number , labelDeployed )
244244 }
245245 }
246246 return
@@ -252,7 +252,7 @@ func (s *server) findTeamPullRequests(prs []pullRequest, team string) (labeled,
252252
253253 lblTeam := teamLabel (team )
254254 if _ , belongs := pr .Labels [lblTeam ]; ! belongs {
255- s .log .Debugf ("PR %v does not belong to %v, skipping it" , pr .Number , team )
255+ s .log .Infof ("PR %v does not belong to %v, skipping it" , pr .Number , team )
256256 continue
257257 }
258258
@@ -316,6 +316,14 @@ func (s *server) getMergedPRs(ctx context.Context, commitSHA string) ([]pullRequ
316316 pr .Labels [string (lbl .Name )] = struct {}{}
317317 }
318318 res = append (res , pr )
319+
320+ s .log .WithFields (
321+ logrus.Fields {
322+ "Number" : pr .Number ,
323+ "URL" : pr .URL ,
324+ "Labels" : pr .Labels ,
325+ },
326+ ).Info ("Added pull request for commit %s" , c )
319327 }
320328 }
321329
0 commit comments