@@ -7,6 +7,7 @@ import type { EmailAddressRow, SubscriberRow } from "knex/types/tables";
77import createDbConnection from "../connect" ;
88import { SerializedSubscriber } from "../../next-auth.js" ;
99import { config } from "../../config" ;
10+ import { logger } from "../../app/functions/server/logging" ;
1011
1112const knex = createDbConnection ( ) ;
1213
@@ -92,7 +93,7 @@ async function updatePrimaryEmail(
9293 } catch ( error ) {
9394 await trx . rollback ( ) ;
9495 // @ts -ignore Type annotations added later; type unknown:
95- console . error ( "updatePrimaryEmail" , error ) ;
96+ logger . error ( "updatePrimaryEmail" , error ) ;
9697 }
9798 const updatedSubscriber = Array . isArray ( subscriberTableUpdated )
9899 ? subscriberTableUpdated [ 0 ]
@@ -255,7 +256,7 @@ async function deleteUnverifiedSubscribers() {
255256 . where ( "primary_verified" , false )
256257 . andWhere ( "created_at" , "<" , expiredTimeStamp )
257258 . del ( ) ;
258- console . info ( "deleteUnverifiedSubscribers" , {
259+ logger . info ( "deleteUnverifiedSubscribers" , {
259260 msg : `Deleted ${ numDeleted } rows.` ,
260261 } ) ;
261262}
@@ -268,15 +269,15 @@ async function deleteUnverifiedSubscribers() {
268269// Not covered by tests; mostly side-effects. See test-coverage.md#mock-heavy
269270/* c8 ignore start */
270271async function deleteSubscriber ( sub : SubscriberRow | SerializedSubscriber ) {
271- console . debug ( "deleteSubscriber" , JSON . stringify ( sub ) ) ;
272+ logger . debug ( "deleteSubscriber" , { id : sub . id } ) ;
272273 try {
273274 await knex ( "subscribers" )
274275 . returning ( "id" )
275276 . where ( "fxa_uid" , sub . fxa_uid )
276277 . del ( ) ;
277278 } catch ( error ) {
278279 // @ts -ignore Type annotations added later; type unknown:
279- console . error ( "deleteSubscriber" , error ) ;
280+ logger . error ( "deleteSubscriber" , { error } ) ;
280281 }
281282}
282283/* c8 ignore stop */
@@ -293,10 +294,10 @@ async function deleteResolutionsWithEmail(id: number, email: string) {
293294 // if email exists in breach resolution, remove it
294295 if ( breachResolution && breachResolution [ email ] ) {
295296 delete breachResolution [ email ] ;
296- console . info ( `Deleting resolution with email: ${ email } ` ) ;
297+ logger . info ( `Deleting resolution with email: ${ email } ` ) ;
297298 return await setBreachResolution ( subscriber , breachResolution ) ;
298299 }
299- console . info ( `No resolution with ${ email } found, skip` ) ;
300+ logger . info ( `No resolution with ${ email } found, skip` ) ;
300301}
301302/* c8 ignore stop */
302303
0 commit comments