How to log events in functions?
Logging events in a system is an important task to get the most useful insights into what is happening in the application. We recommend following some conventions to achieve a consistent way of logging events.
Using the Firebase functions logger, pass to the first argument a string with the event description using capital letters and underscore between the words, and to the second argument, pass any data you want to log:
How should you log events?
For example, you may want to log an event when a Stripe charge is made. You can then pass the customer ID and the amount of the charge:
How should I log errors?
Errors are logged the same as the above events, but the description starts with the ERROR_
prefix, and the data should have a message with an error string:
Last updated