@@ -89,7 +89,7 @@ function deleteHooks(reponame, url, token, callback) {
8989 . set ( 'User-Agent' , 'StriderCD (http://stridercd.com)' )
9090 . end ( function ( res ) {
9191 if ( res . status !== 204 ) {
92- console . log ( 'bad status' , res . status , hook . id , hook . url ) ;
92+ debug ( 'bad status' , res . status , hook . id , hook . url ) ;
9393 return next ( new Error ( 'Failed to delete a webhook: status for url ' + hook . url + ': ' + res . status ) ) ;
9494 }
9595 next ( ) ;
@@ -151,7 +151,7 @@ var get_oauth2 = module.exports.get_oauth2 = function (url, q_params, access_tok
151151 client = client || superagent ;
152152 // Construct the query. Allow the user to override the access_token through q_params.
153153 var query = _ . assign ( { } , { access_token : access_token } , q_params ) ;
154- console . debug ( 'GET OAUTH2 URL:' , url ) ;
154+ debug ( 'GET OAUTH2 URL:' , url ) ;
155155 client
156156 . get ( url )
157157 . query ( query )
@@ -173,7 +173,7 @@ var api_call = module.exports.api_call = function (path, access_token, callback,
173173 // If the user provided a superagent instance, use that.
174174 client = client || superagent ;
175175 var url = GITHUB_API_ENDPOINT + path ;
176- console . debug ( 'API CALL:' , url , access_token ) ;
176+ debug ( 'API CALL:' , url , params , access_token ) ;
177177 get_oauth2 ( url , { } , access_token , function ( error , res , body ) {
178178 if ( ! error && res . statusCode == 200 ) {
179179 var data = JSON . parse ( body ) ;
@@ -231,8 +231,8 @@ var pageinated_api_call = module.exports.pageinated_api_call = function (path, a
231231 var base_url = GITHUB_API_ENDPOINT + path ;
232232
233233 if ( ! access_token ) {
234- console . error ( 'Error in request - no access token' ) ;
235- console . trace ( ) ;
234+ debug ( 'Error in request - no access token' ) ;
235+ debug ( new Error ( ) . stack ) ;
236236 }
237237
238238 // This is a left fold,
@@ -241,7 +241,7 @@ var pageinated_api_call = module.exports.pageinated_api_call = function (path, a
241241 var pages = [ ] ;
242242
243243 function loop ( uri , page ) {
244- console . debug ( 'PAGINATED API CALL URL:' , uri ) ;
244+ debug ( 'PAGINATED API CALL URL:' , uri ) ;
245245 get_oauth2 ( uri , { per_page : 30 , page : page } , access_token , function ( error , res , body ) {
246246 if ( ! error && res . statusCode == 200 ) {
247247 var data ;
@@ -310,7 +310,7 @@ function getRepos(token, username, callback) {
310310 } ,
311311 function fetchOrgTeams ( err , githubRepos , githubOrgas ) {
312312 if ( err ) {
313- console . error ( 'get_github_repos() - Error fetching repos & orgs: %s' , err ) ;
313+ debug ( 'get_github_repos() - Error fetching repos & orgs: %s' , err ) ;
314314 return callback ( err ) ;
315315 }
316316 if ( ! githubRepos ) return callback ( 'Get repos failed; no response' ) ;
@@ -343,7 +343,7 @@ function getRepos(token, username, callback) {
343343 } ,
344344 function fetchTeamDetails ( err , results ) {
345345 if ( err ) {
346- console . error ( 'get_github_repos() - Error fetching Org Teams response - %s' , err ) ;
346+ debug ( 'get_github_repos() - Error fetching Org Teams response - %s' , err ) ;
347347 return callback ( err ) ;
348348 }
349349 var teams = [ ] ;
@@ -354,7 +354,7 @@ function getRepos(token, username, callback) {
354354 teams . push ( t ) ;
355355 } ) ;
356356 } catch ( e ) {
357- console . error ( 'get_github_repos(): Error parsing JSON in Org Teams response - %s' , e ) ;
357+ debug ( 'get_github_repos(): Error parsing JSON in Org Teams response - %s' , e ) ;
358358 }
359359 } ) ;
360360
@@ -366,7 +366,7 @@ function getRepos(token, username, callback) {
366366 } ,
367367 function filterTeams ( err , results ) {
368368 if ( err ) {
369- console . error ( 'get_github_repos() - Error fetching detailed team response - %s' , err ) ;
369+ debug ( 'get_github_repos() - Error fetching detailed team response - %s' , err ) ;
370370 return callback ( err ) ;
371371 }
372372 var team_details = [ ] ;
@@ -375,7 +375,7 @@ function getRepos(token, username, callback) {
375375 var td = JSON . parse ( result . body ) ;
376376 team_details . push ( td ) ;
377377 } catch ( e ) {
378- console . error ( 'get_github_repos(): Error parsing JSON in detail team response - %s' , e ) ;
378+ debug ( 'get_github_repos(): Error parsing JSON in detail team response - %s' , e ) ;
379379 }
380380 } ) ;
381381 // For each Team with admin privs, test for membership
@@ -387,7 +387,7 @@ function getRepos(token, username, callback) {
387387 }
388388 team_detail_requests [ team_details . id ] = team_details ;
389389 var url = GITHUB_API_ENDPOINT + '/teams/' + team_details . id + '/members/' + username ;
390- console . debug ( 'TEAM DETAIL URL' , url ) ;
390+ debug ( 'TEAM DETAIL URL' , url ) ;
391391 get_oauth2 ( url , { } , token , group ( ) ) ;
392392 } ) ;
393393 this . team_detail_requests = team_detail_requests ;
@@ -396,7 +396,7 @@ function getRepos(token, username, callback) {
396396 // the list of repositories it has access to.
397397 function fetchFilteredTeamRepos ( err , results ) {
398398 if ( err ) {
399- console . debug ( 'get_github_repos(): Error with admin team memberships: %s' , err ) ;
399+ debug ( 'get_github_repos(): Error with admin team memberships: %s' , err ) ;
400400 return callback ( err )
401401 }
402402 var team_detail_requests = this . team_detail_requests ;
@@ -421,7 +421,7 @@ function getRepos(token, username, callback) {
421421 // Reduce all the results and call output callback.
422422 function finalize ( err , results ) {
423423 if ( err ) {
424- console . debug ( 'get_github_repos(): Error with team repos request: %s' , err ) ;
424+ debug ( 'get_github_repos(): Error with team repos request: %s' , err ) ;
425425 return callback ( err ) ;
426426 }
427427 _ . each ( results , function ( result ) {
0 commit comments