@@ -17,8 +17,8 @@ const config = require('./../config/config.js')[env]
1717const logger = require ( '../utils/logger' )
1818
1919const overkillLogging = ( req , error ) => {
20- console . log ( 'request: ' , req )
21- console . log ( 'error: ' , error )
20+ logger . debug ( 'request: ' , req )
21+ logger . error ( 'error: ' , error )
2222}
2323
2424const validationErrorMessages = {
@@ -291,7 +291,7 @@ module.exports = {
291291 } )
292292 }
293293 if ( course . active === false ) {
294- console . log ( ' course is not active')
294+ logger . info ( 'course registration failed because course is not active')
295295 overkillLogging ( req , null )
296296 return res . status ( 400 ) . send ( {
297297 message : 'course is not active'
@@ -368,38 +368,32 @@ module.exports = {
368368
369369 try {
370370 if ( req . authenticated . success ) {
371- console . log ( '\nauth success\n' )
372371 CourseInstance . findOne ( {
373372 where : {
374373 ohid : req . body . ohid
375374 }
376375 } )
377376 . then ( course => {
378377 if ( ! course ) {
379- console . log ( '\nkurssia ei löytynyt\n' )
380378 res . status ( 404 ) . send ( 'course not found' )
381379 return
382380 }
383- console . log ( '\nkurssi löytyi\n' )
384381 StudentInstance . find ( {
385382 where : {
386383 userId : req . decoded . id ,
387384 courseInstanceId : course . id
388385 }
389386 } ) . then ( targetStudent => {
390387 if ( ! targetStudent ) {
391- console . log ( '\nopiskelijaa ei löytynyt\n' )
392388 res . status ( 404 ) . send ( 'Student not found' )
393389 return
394390 }
395- console . log ( '\nopiskelija löytyi\n' )
396391 return targetStudent
397392 . update ( {
398393 github : req . body . github || targetStudent . github ,
399394 projectName : req . body . projectname || targetStudent . projectName
400395 } )
401396 . then ( updatedStudentInstance => {
402- console . log ( '\nUpdated student project info succesfully\n' )
403397 res . status ( 200 ) . send ( updatedStudentInstance )
404398 } )
405399 . catch ( ( error ) => {
@@ -588,7 +582,6 @@ module.exports = {
588582 getNewer ( req , res ) {
589583 helper . controller_before_auth_check_action ( req , res )
590584
591- console . log ( 'update next...' )
592585 const auth = process . env . TOKEN || 'notset' //You have to set TOKEN in .env file in order for this to work
593586 const termAndYear = helper . CurrentTermAndYear ( )
594587 if ( auth === 'notset' ) {
0 commit comments