@@ -3,8 +3,10 @@ import 'dart:typed_data';
33
44import 'package:functions_client/src/constants.dart' ;
55import 'package:functions_client/src/types.dart' ;
6+ import 'package:functions_client/src/version.dart' ;
67import 'package:http/http.dart' as http;
78import 'package:http/http.dart' show MultipartRequest;
9+ import 'package:logging/logging.dart' ;
810import 'package:yet_another_json_isolate/yet_another_json_isolate.dart' ;
911
1012class FunctionsClient {
@@ -13,6 +15,7 @@ class FunctionsClient {
1315 final http.Client ? _httpClient;
1416 final YAJsonIsolate _isolate;
1517 final bool _hasCustomIsolate;
18+ final _log = Logger ("supabase.functions" );
1619
1720 /// In case you don't provide your own isolate, call [dispose] when you're done
1821 FunctionsClient (
@@ -24,7 +27,9 @@ class FunctionsClient {
2427 _headers = {...Constants .defaultHeaders, ...headers},
2528 _isolate = isolate ?? (YAJsonIsolate ()..initialize ()),
2629 _hasCustomIsolate = isolate != null ,
27- _httpClient = httpClient;
30+ _httpClient = httpClient {
31+ _log.config ("Initialize FunctionsClient v$version " );
32+ }
2833
2934 /// Getter for the headers
3035 Map <String , String > get headers {
@@ -129,6 +134,8 @@ class FunctionsClient {
129134 request.headers[key] = value;
130135 });
131136
137+ _log.finer ('Request: ${request .method } ${request .url } ${request .headers }' );
138+
132139 final response = await (_httpClient? .send (request) ?? request.send ());
133140 final responseType = (response.headers['Content-Type' ] ??
134141 response.headers['content-type' ] ??
@@ -167,6 +174,7 @@ class FunctionsClient {
167174 ///
168175 /// Does nothing if you pass your own isolate
169176 Future <void > dispose () async {
177+ _log.fine ("Dispose FunctionsClient" );
170178 if (! _hasCustomIsolate) {
171179 return _isolate.dispose ();
172180 }
0 commit comments