Developer Logs
Developer logs are used to log general information, errors, warnings, and debugging information. The method follows a predefined structure that needs to be adhered to for consistency. To log a developer event, use the info
, error
, warn
, or debug
method on the HubtelEventPub
instance. See usage examples below:
- Info
Used for logging general information about application activity. These logs indicate routine operations and successes.
eventPub.info({
eventType: "Regular",
actionName: "user_logged_in",
// additional properties
});
- Error
Logs serious issues that impact application functionality, such as runtime errors.
eventPub.error({
eventType: "Error",
actionName: "fetch_failed",
// additional properties
});
- Warn
Indicates potential issues that aren't yet critical but require attention.
eventPub.warn({
eventType: "Regular",
actionName: "restricted_feature_access",
// additional properties
});
- Debug
Logs detailed debugging information for developers to diagnose issues during development.
eventPub.debug({
eventType: "Regular",
ActionName: "Fetching user profile details",
// additional properties
});
Working in Development
When working in a dev environment, events are not logged to the portal but instead in your console. This is to minimize unnecessary logs and activity during development. To test if your setup is working as expected, set developerMode
to false
in the defaults provided to the HubtelEventPub
class. Please note that this is supposed to be for testing your setup and should be cleared immediately after tests.
Was this helpful? 📚
CHAT SAMMIAT