ekyc

Electronic KYC process with uploading ID document using OAuth 2.1 (experimental)
Log | Files | Refs | README | LICENSE

logger.ts (510B)


      1 export class Logger {
      2   constructor(readonly context: Record<string, unknown> = {}) {
      3   }
      4 
      5   /**
      6    * Log event
      7    *
      8    * @param message
      9    * @param context
     10    */
     11   write(message: unknown, context: Record<string, unknown> = {}): void {
     12     if (!(message instanceof Error)) {
     13       console.log(message, { ...this.context, ...context });
     14       return;
     15     }
     16 
     17     console.group("Exception:");
     18     console.log("Context:", { ...this.context, ...context });
     19     console.error(message);
     20     console.groupEnd();
     21   }
     22 }