DEV Community 👩‍💻👨‍💻

Stanislav Ilin
Stanislav Ilin

Posted on • Updated on

Filtering application logs

🚀 New talker feature in 2.1.0 release is filtering logs, exceptions and errors. Now I want to tell you how it works.

There can be a lot of logs in a large application. Working with network via http, local storage, controllers, exceptions, errors, verbose info, etc.

👀 Sometimes it becomes difficult to track something very important. And at this moment, the talker update is rushing to your aid.

⚙️ Filtering data with Talker

Let's imagine that there are a lot of logs in your application

Talker logs

But our interest is to see only navigation logs.
How we can make it?

Talker logs selected

Add filter to your Talker constructor, or set it by configure() method

  final talker = Talker(
    filter: BaseTalkerFilter(
      types: [TalkerRouteLog],
    ),
  );
Enter fullscreen mode Exit fullscreen mode
  final talker = Talker();
  talker.configure(
    filter: BaseTalkerFilter(
      types: [TalkerRouteLog],
    ),
  );
Enter fullscreen mode Exit fullscreen mode

types: - log types driven by Talker package or your custom logs that you create. How I can make custom log?

Result:
Logs gif

But, how can I make it if I do not know what type of log is it?
Talker can do it 🙂 Use titles: filed of filter

  final talker = Talker(
    filter: BaseTalkerFilter(
      titles: ['ROUTE'],
    ),
  );
Enter fullscreen mode Exit fullscreen mode

Result will be same as of types: [TalkerRouteLog]

Thank you for reading post!
💻 Article example source code here

Show some ❤️ and put a star on the GitHub to support the project! We are trying to make the best logs and errors manager for Flutter applications.

Top comments (8)

Collapse
 
durgesh4993 profile image
Durgesh kumar prajapati

Great article

Collapse
 
frezyx profile image
Stanislav Ilin

Thank you !

Collapse
 
rizkytegar profile image
🎉 Rizky Tegar Pratama

great

Collapse
 
frezyx profile image
Stanislav Ilin

Thanks

Collapse
 
ronaldocoding profile image
Ronaldo Costa de Freitas

Great article, bro, keep going

Collapse
 
frezyx profile image
Stanislav Ilin

Thanks

Collapse
 
superflowsdev profile image
Hrushi M • Edited on

Also think of storing them remotely and making them available for access and analysis later..

Collapse
 
frezyx profile image
Stanislav Ilin

Thanks for this comment! I also thinking about it.
This will be the next big thing.

Stop sifting through your feed.

Find the content you want to see.

Change your feed algorithm by adjusting your experience level and give weights to the tags you follow.