When setting up cron jobs in Dart, it is important to track their execution status. A minor failure in a cron job can cause your Dart application to stop working correctly. SaasHound makes it easy to track your cron jobs and their execution status in real time.
Setting up SaasHound with Dart is straightforward! Follow these steps:
Once your SaasHound account is set up, you can use the following code snippet to track your cron jobs. Replace API_KEY
with your SaasHound API key and update your project name.
import 'dart:convert'; import 'package:http/http.dart' as http;
Future<void> logEvent() async { final apiUrl = Uri.parse('https://api.saashound.co/log-event');
final headers = <String, String>{ 'Content-Type': 'application/json', 'Authorization': 'Bearer API_TOKEN', };
final payload = jsonEncode({ 'project': 'my-project', 'channel': 'cron-jobs', 'event': 'Cronjob Started', 'description': 'job id: email-notifications', 'icon': '⏰', 'notify': true });
try { final response = await http.post( apiUrl, headers: headers, body: payload, );
if (response.statusCode >= 200 && response.statusCode < 300) { print('Log event sent successfully!'); } else { print('Failed to send log event. Response code: ${response.statusCode}'); } } catch (error) { print('Error sending log event: $error'); } }
void main() { logEvent(); }
SaasHound is an amazing event tracking tool that works seamlessly with your Dart application. With SaasHound, tracking cron jobs during their execution becomes a breeze! You’ll get real-time push notifications right on your desktop and mobile devices whenever a new cron job is executed. How cool is that? 😎
But wait, there’s more! SaasHound provides simple charts and data filtering options, so you can easily dive into the nitty-gritty and gain valuable insights into your Dart application’s performance. It’s user-friendly, making event tracking efficient and hassle-free.
So, what are you waiting for? Sign up for a free SaasHound account now, set up your Dart cron jobs, and experience the power of effortless event tracking like never before!