app_logger 0.0.2 copy "app_logger: ^0.0.2" to clipboard
app_logger: ^0.0.2 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.2

import package


import 'package:app_logger/app_logger.dart';

We init the package

void main() {
  AppLogger.init(
    'https://lokiBaseUrl',
    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
lokiUrl BaseUrl
lokiHeaders Laki Header
callBackFun When the log is made, the function called receives the log to Loki if it is null.
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