app_logger 0.0.3 copy "app_logger: ^0.0.3" to clipboard
app_logger: ^0.0.3 copied to clipboard

Log all Http request and Navigation.

alt_text

app_logger #

A package for log exception, http request and navigation

Usage #

add this line to pubspec.yaml


dependencies:
  app_logger: ^0.0.3

import package


import 'package:app_logger/app_logger.dart';

We init the package

void main() {
  AppLogger.init(
    'https://example.com',
    true,
    true,
        () => runApp(const MyApp()),
  );
}

Then to change the configuration of the package

AppLogger.instance.configuration.setUser(
  AppLoggerUser(id: '123123213123', username: 'Mustafa'),
);

Navigation Logger

MaterialApp(
  navigatorObservers: [NavigationLogger.instance],
  onGenerateRoute: MyRouteFactory().main.onGenerateRoute,
);

Api Logger

Future<void> getRequest() async {
  final uri = Uri.https('jsonplaceholder.typicode.com', 'todos/1');
  final res = await http.get(
    uri,
    headers: {"content-type": "application/json"},
  );
  HttpLogger.instance.log(
    url: uri.toString(),
    statusCode: res.statusCode,
    header: {},
    requestBody: {},
    responseBody: res.body,
  );
}

Parameters #

Parameter Descriptions
baseUrl BaseUrl
headers Header
callBackFun If is not null, the function is called when a log is taken. If it is null, a post request is sent to the endpoint given in baseUrl.
onError Runs when an error occurs
configuration
httpLog Http log status
navigationLog Navigation log status
killAppOnError Should the application close when an error occurs?
killAppOnErrorCausedByFlutter Should Flutter close the application when an error occurs?
user user
3
likes
0
points
49
downloads

Publisher

verified publishermustafaturkmen.dev

Weekly Downloads

Log all Http request and Navigation.

License

unknown (license)

Dependencies

background_json_parser, battery_plus, device_info_plus, dio, flutter, package_info_plus

More

Packages that depend on app_logger