The writing for the postgraduate examination

It is vividly illustrated in the drawing that the drastically dynamic development of fishing. While there is just one fish left, with an abundant amount of boat preying in 1996, there used to have…

Smartphone

独家优惠奖金 100% 高达 1 BTC + 180 免费旋转




Logging in Flutter

I am sure that every developer out there has heard this phrase ‘Check the logs’ at least once in their career and checking the logs have saved us several times in many different situations. But what exactly a log message is and what are the advantages and disadvantages of logging? Let’s try to find out!

While developing mobile applications we, as developers, tend to put a lot of different logging priorities into our code. The reason why we do this is that we want to analyze certain activity in our apps. E.G. logic flows, stack-trace of methods execution, network requests, etc. This helps us to quickly identify and fix the issues that are hard to debug and reproduce.

If used properly, logging can be a life-saving mechanism for discovering bugs, performance issues and other problems. But if done poorly, it can make your life miserable… We all know that feeling of going through thousands and thousands of lines of log messages without any useful info at all.

FLog is written in Dart and provides many of the advanced features needed for logging. Logs are saved in a database, which can then be exported as a zip file, which can then be uploaded to a server or to use locally to identify and debug issues. The logs can be filtered and sorted easily based on many useful filters available.

There are also several different types of log messages, which can be used in different situations:

To add FLogs to your flutter project, just paste in the below line in to pubspec.yaml file and get the dependencies.

Log files are exported to a storage directory, so it’s very important to add storage permission to your project:

Android:

iOS:

In-order to use logs, you can either provide your own configuration or use the one provided by FLogs. The default configuration can be requested by calling FLog.getDefaultConfigurations() method, which you can then override by providing your own set of values against each variable. Logs can be disabled by simply setting isLogsEnabled = false.

To save logs, simply call any of the convenient methods mentioned below:

1. Simple Info Log

2. Simple Warning Log

3. Error Log

4. Severe Log

5. Exception Log

6. Data Log

7. printLogs

8. getAllLogsByCustomFilter

9. getAllLogsByFilter

10. clearLogs

11. applyConfigurations

That's it for this article! If you liked it then don’t forget to clap, comment and share with friends!

Add a comment

Related posts:

COMM 206 Writing Portfolio

All my life I have wanted to connect with people through writing. When I was a kid, my dream for “when I grew up” was to write children's books. Now I often consider going into news broadcast…

How to Learn Programming?

Programming is the process of taking an algorithm and encoding it into a notation, a programming language, so that it can be executed by a computer. Apart from this there are many other cool stuffs…

Portfolio Optimization and Performance Evaluation

Signals generated by alpha factors are converted into trades through algorithmic trading. The market then becomes long and short as a result of these trades. In order for the strategy to succeed, it…