flutter_logs_firebase_timber

Last updated:

0 purchases

flutter_logs_firebase_timber Image
flutter_logs_firebase_timber Images
Add to Cart

Description:

flutter logs firebase timber

This project utilizes the Timber library for efficient logging across both Android and iOS platforms. Timber provides a lightweight yet powerful logging utility that helps in managing log statements effortlessly. For enhanced remote debugging, we've integrated Firebase, which captures and posts these logs in real-time to the Firebase console. This setup allows for seamless monitoring and debugging of the application, ensuring that critical issues can be identified and resolved promptly. By leveraging Timber's logging capabilities and Firebase's robust cloud infrastructure, we achieve a reliable and scalable remote logging solution, facilitating better maintenance and quicker iterations during the development cycle.
Features #

Efficiently track logs both remotely and locally, ensuring comprehensive monitoring and analysis capabilities.
Seamlessly monitor application logs directly within the Firebase console, providing an integrated and streamlined user experience.
Designed with ease of use in mind, it offers an intuitive and accessible interface for users of all technical levels.
Realtime database screenshot:


Getting started #

Add the package to your pubspec.yaml file:

flutter_logs_firebase_timber: ^0.0.3
copied to clipboard

Run the command to fetch all the dependencies listed in your pubspec.yaml file and makes them available in your project.

flutter pub get
copied to clipboard
Firebase Setup #

Create a Firebase project in the Firebase console.
Register your app by clicking the Flutter icon in the Project Overview section.



Follow the given instructions for CLI setup.

A. Configure Firebase Realtime Database rules for public read and write access: #

Select your Firebase project.
Navigate to Realtime Database:


Click on "Build" in the left-hand menu, then select "Realtime Database".


Open the Rules Tab:


Click on the "Rules" tab in the Realtime Database section.


Set Public Read and Write Access:


Replace the existing rules with the following code to allow public read and write access. Note that setting public access is generally not recommended for production applications due to security risks. Use this configuration only for testing or development purposes.

{

"rules": {

".read": "true",

".write": "true"

}

}
copied to clipboard

Click the "Publish" button to apply the changes.

Important Note: #

Setting .read and .write to true allows anyone with the database URL to read and write data, posing significant security risks. For production environments, implement proper security rules to protect your data. For example, allow access only to authenticated users:

{
"rules": {

".read": "auth != null",

".write": "auth != null"

}

}
copied to clipboard
Example #
Initializes the FlutterLogsFirebaseTimber package.This method should be called once during the application startup.
await RemoteLogger.initialize();
copied to clipboard

To perform asynchronous operations before the runApp() method is called, such as initializing a database or fetching initial configuration settings, you should ensures that the binding between the Flutter framework and the underlying platform (such as iOS or Android) is fully initialized at the beginning of the main() function.

WidgetsFlutterBinding.ensureInitialized();
copied to clipboard

Asynchronously initializes for RemoteLogger.

void main() async {
// Ensure that the Flutter framework is initialized
WidgetsFlutterBinding.ensureInitialized();
//Initialze the package only for debug mode
if (kDebugMode) {
await RemoteLogger.initialize();
}
runApp(const MyApp());
}
copied to clipboard
Usage #
This is a static method call to the log function of the RemoteLogger class providing functionality to send log messages to a logging service on Firebase.
RemoteLogger.log(
logLevel: LogLevel.info,
tag: "onPressed()",
message: "This is a log message",
error: null)
copied to clipboard
Additional information #
We hope you find FlutterLogsFirebaseTimber useful!

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.