@@ -4,6 +4,7 @@ const org = require('../../src/models/organization')
44const { pick, prop, assoc } = require ( 'ramda' )
55const { ValidationError, PropertyRequiredError } = require ( '../lib/utils' )
66const Boom = require ( '@hapi/boom' )
7+ const logger = require ( '../../src/lib/logger' )
78
89/**
910 * Gets a user profile in an org
@@ -297,7 +298,7 @@ function createProfileKeys(ownerType, profileType) {
297298 const data = await profile . addProfileKeys ( attributesToAdd , ownerType , id )
298299 return reply . send ( data )
299300 } catch ( err ) {
300- console . error ( err )
301+ logger . error ( err )
301302 if (
302303 err instanceof ValidationError ||
303304 err instanceof PropertyRequiredError
@@ -324,7 +325,7 @@ async function modifyProfileKey(req, reply) {
324325 await profile . modifyProfileKey ( id , body )
325326 return reply . status ( 200 ) . send ( )
326327 } catch ( err ) {
327- console . error ( err )
328+ logger . error ( err )
328329 if (
329330 err instanceof ValidationError ||
330331 err instanceof PropertyRequiredError
@@ -349,7 +350,7 @@ async function deleteProfileKey(req, reply) {
349350 await profile . deleteProfileKey ( id )
350351 return reply . status ( 200 ) . send ( )
351352 } catch ( err ) {
352- console . error ( err )
353+ logger . error ( err )
353354 if (
354355 err instanceof ValidationError ||
355356 err instanceof PropertyRequiredError
@@ -379,7 +380,7 @@ function getProfileKeys(ownerType, profileType) {
379380 )
380381 return reply . send ( data )
381382 } catch ( err ) {
382- console . error ( err )
383+ logger . error ( err )
383384 if (
384385 err instanceof ValidationError ||
385386 err instanceof PropertyRequiredError
@@ -410,7 +411,7 @@ function setProfile(profileType) {
410411 await profile . setProfile ( body , profileType , id )
411412 reply . status ( 200 ) . send ( )
412413 } catch ( err ) {
413- console . error ( err )
414+ logger . error ( err )
414415 throw Boom . badImplementation ( )
415416 }
416417 }
@@ -425,7 +426,7 @@ async function getMyProfile(req, reply) {
425426 const data = await profile . getProfile ( 'user' , user_id )
426427 return reply . send ( data )
427428 } catch ( err ) {
428- console . error ( err )
429+ logger . error ( err )
429430 throw Boom . badImplementation ( )
430431 }
431432}
@@ -437,7 +438,7 @@ async function setMyProfile(req, reply) {
437438 await profile . setProfile ( body , 'user' , user_id )
438439 return reply . status ( 200 ) . send ( )
439440 } catch ( err ) {
440- console . error ( err )
441+ logger . error ( err )
441442 throw Boom . badImplementation ( )
442443 }
443444}
0 commit comments