Last updated:
0 purchases
fluttter socket log plugin
flutter_socket_log_plugin #
Logging flutter apps to remote using socket. In order to connect to remote app, you need to be in the same local network. The tester will be able to see all the logs inside the client app.
You can find the client app source code here.
Client application to watch logs #
Installation #
Add
flutter_socket_log_plugin : # latest version
copied to clipboard
or run
flutter pub add flutter_socket_log_plugin
copied to clipboard
How to Use #
Install Client Application
Install client app using the flutter source code for windows, linux, mac, android, ios or install app for windows and android.
Basic Usage
Initialize the plugin in main function
void main() {
// add conditions to initialize the plugin
FlutterSocketLogPlugin.init(appName: 'Dummy App');
runApp(const MyApp());
}
copied to clipboard
Log to remote client app
FlutterSocketLogPlugin.log(
'Write your logs',
DefaultLogs.debug, // customize logs if you want
[DefaultLogs.network], // add your log tags, customize tags
);
copied to clipboard
Customize Log Levels and Log Tags
Initialize your log tag and log level
List<LogLevel> logLevels = [
FlutterSocketLogPlugin.createLogLevel(
'Critical',
Colors.cyan.value,
Icons.warning.codePoint,
),
FlutterSocketLogPlugin.createLogLevel(
'Alert',
Colors.red.value,
Icons.error.codePoint,
)
];
List<LogTag> logTags = [
FlutterSocketLogPlugin.createTag(
'Request',
Colors.blue.value,
Icons.network_wifi.codePoint,
),
FlutterSocketLogPlugin.createTag(
'Response',
Colors.green.value,
Icons.network_wifi.codePoint,
),
];
copied to clipboard
Add customizations to init function
FlutterSocketLogPlugin.init(
appName: 'Customized App',
logLevels: logLevels,
logTags: logTags,
);
copied to clipboard
Start Logging
FlutterSocketLogPlugin.log(
'Write your logs here',
logLevels[0],
[
logTags[0],
logTags[1],
]
);
copied to clipboard
Once you define your custom methods it could be as simple as this:
Logger.debugNetwork('Write your log here');
copied to clipboard
Log Tags and Log Levels
Log Tags and Log Levels are customizable which means that you can create your own by custom names, colors as well as icons. As a result you can get those in the client application.
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.