FFEL Firebase Email Logger.
FFEL is an alternate logging system for NodeJS applications. It uses SendGrid to send emails with an error message to a specified email address. It was developed for programs running on Firebase Functions, but could be used anywhere an email needs to be sent.
FFEL can be installed via the Github Package Repository:
npm install @jaredforth/ffel@1.0.1
or NPM:
npm install ffel
To import the main Logger
class, use:
const { Logger } = require('ffel');
The Logger
class takes one argument, which must be an
object of the form:
const msg = {
to: 'email@example.com',
from: 'email@example.com',
subject: 'Example Subject',
text: 'A message to send',
apiKey: 'Your SendGrid API key'
}
Initialize with:
const logger = new Logger(msg);
Once setup has been completed, you can use the log()
method to send an email via SendGrid and have your error logged to the console:
logger.log("Your error message")
This will send an email to the to
field specified in the
initialization argument and log the error to the console.