Skip to content

BenjaminMahmic/get_connect_logger

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BM GetConnect Logger

BM GetConnect Logger is a lightweight and efficient logging package for GetConnect. It logs both the request and response of the GetConnect client, providing valuable insights for debugging and development.

Safety

This package is designed with production safety in mind. It only logs the request and response when the app is in debug mode, ensuring no sensitive data is logged in a production environment.

Usage

import 'package:get/get.dart';
import 'package:get_connect_logger/get_connect_logger.dart';

class ApiService extends GetConnect {
  @override
  void onInit() {
    GetConnectLogger.instance.enableLogger(httpClient);
    super.onInit();
  }
}

// Alternatively

class ApiService extends GetConnect {
  ApiService() {
    GetConnectLogger.instance.enableLogger(httpClient);
  }
}

About enableLogger

enableLogger is a method in the GetConnectLogger singleton class. It enables logging for HTTP requests and responses made by the GetConnect instance.

Despite the number of times enableLogger is called, logging will only be enabled once. This is because enableLogger checks if logging is already enabled before proceeding. If logging is already enabled, enableLogger will return without performing any action.

This design prevents unnecessary multiple logging activations, which could potentially lead to performance issues.

Result

Screenshot_2

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages