log method
Logs an event to the console.
This method logs an event to the console.
eventName
is the name of the event.level
is the level of the event. (info, warning, error, trace, debug)parameters
is a map containing the parameters of the event.
Example:
LocalEventStore.logEvent("login", EventLevel.info, {
"custom_parameter": "custom_value",
});
The event will be stored in the 'logs' collection with the following fields:
- user_id: The UID of the current user.
- email: The email of the current user.
- level: The level of the event.
- event: The name of the event.
- timestamp: The timestamp of the event.
- custom_parameter: The custom value of the event.
Implementation
void log(
String eventName, EventLevel level, Map<String, dynamic> parameters) {
debugPrint(
"{\"@t\": ${DateTime.now()}, \"@u\": \"user_id\", \"@e\": \"user_email\", \"@l\": \"${level.toString().split('.').last}\", \"@c\": \"$_collectionName\", \"@n\": \"$eventName\", \"@p\": \"$parameters\"}");
}