messagebird / firestore-send-msg

Source code for MessageBird Firebase send message extension
Apache License 2.0
11 stars 11 forks source link

Use Cloud Functions logger SDK instead of `console` #17

Closed jhuleatt closed 3 years ago

jhuleatt commented 3 years ago

The logs in https://github.com/messagebird/firestore-send-msg/blob/master/functions/src/log.ts use console.warn and console.info. This will result in objects being displayed as multiple separate log entries, which are hard to read (some more detail here).

Instead, use the Cloud Functions logger SDK. Example:

Instead of:

console.info(`INFO: firestore-messagebird-send-msg: ${msg}`, ...rest);

Use:

import { logger } from 'firebase-functions';

// ....

logger.info(`INFO: firestore-messagebird-send-msg: ${msg}`, ...rest);

Here's an example from a Firebase-made extension.