# Understand logging | flutter

Ok, So let's start with simple logging first, Which every developer knew

`print()`

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1677405592194/f05e1ef5-d433-4fd7-88d8-75cbe706331f.png align="left")

easy to start by logging in to flutter. Right 😀

### Okay now, let's play with more sample log data.

1. "Hello world!"
    
2. "I\\'m Kishansinh Parmar"
    
3. %[https://gist.github.com/imkishansinh/8653ff8054a5f64735e1712aa8329611] 
    

The result of the logs

1. ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1677406335986/5515018c-a864-4cf7-a30e-e74ca7ec3aca.png align="left")
    
2. ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1677406348983/c1764f9e-c4ad-4b86-a272-dcc2f5d24cc2.png align="left")
    
3. ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1677406367535/8037e5dc-e8cb-428e-a216-5571fda45ce1.png align="center")
    

As you can see that first 2 sample data print everything correctly but what happen with 3rd sample data? It discards some lines from the output, which we aren't expecting right?

> If you output too much at once, then Android sometimes discards some log lines. To avoid this, use [`debugPrint()`](https://api.flutter.dev/flutter/foundation/debugPrint.html), from Flutter’s `foundation` library. This is a wrapper around `print` that throttles the output to a level that avoids being dropped by Android’s kernel.

> The other option for application logging is to use the `dart:developer` [`log()`](https://api.flutter.dev/flutter/dart-developer/log.html) function. This allows you to include a bit more granularity and information in the logging output.

Now let's print longer string outputs using the log() function. It works ✌🏻

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1677406867303/bc7cf6a5-a1c1-496a-b82b-2de5ba5268c2.png align="center")

So as we experienced the developer log() function makes sense for logging in to flutter. Nice

### But, wait are you looking for something which is more beautiful for logging then try this package which helps you to log better visible logs.

%[https://pub.dev/packages/logger] 

### Caution ⚠️: This package also reduces your log lines if a message is longer.

So my suggestion is to extend the logger class into your own class and gives your class more power with the developer:log function.

### Tip: Extend Logger class to your own class

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1677407364859/f1951ba3-19b4-4e62-8d9b-c6b9709511ce.png align="center")
