An open API service indexing awesome lists of open source software.

https://github.com/kamchur/flutter_logcat

Flutter (console)Logcat Filter
https://github.com/kamchur/flutter_logcat

dart flutter logcat

Last synced: 6 months ago
JSON representation

Flutter (console)Logcat Filter

Awesome Lists containing this project

README

          

![flutter_logcat_transparent](https://github.com/b3lon9/flutter_logcat/assets/119420119/0493edfd-c9e2-4bb3-b7fd-706d7ecd4977)


[![Pub Version](https://img.shields.io/pub/v/flutter_logcat?color=blue)](https://pub.dev/packages/flutter_logcat)

In Flutter, logs are displayed in the console without any distinguishing colors.

However, by using this package, you can view messages in the console with colors that you define.

Additionally, you can configure it so that logs are hidden in debug mode, and you can also set it to display tags, file paths, and timestamps.


## πŸ“Έ Demo

In Console

### iOS & Others
> image

### Android
> image




## πŸ“Œ Features
- [Usage](#-usage)
- [Configure](#-set-log-configure)
- [Stream](#-stream-logcat-messages)
- [History](#-history-logcat-prints)


## 🌱 Getting Started

[Install Package](https://pub.dev/packages/flutter_logcat/install/)

`flutter_logcat` need only three parameters there are `message`, `tag`, `path`, `time`, `history`.

- `message` : If yon want input message to watch on console.

- `tag`: Custom own your's tag name.

- `path`: You can watch file preference path. (default: false)

- `time`: You can watch current time. (default: false)

- `history`: You can call log history all prints.


## πŸ’Œ Console Print

Parameters

| parameter | required | type | default | output |
| ---------------------| ------------------------|--------------------|-------------|---------------------------------------------------------------|
| message | :heavy_check_mark: | String | | `[className:lineNumber] message` |
| tag | :x: | String | | `(tag) [className:lineNumber] message` |
| path | :x: | bool | false | `[className(packageName/className.dart):lineNumber] message` |
| time | :x: | bool | false | `2024-09-25T00:00:000.000000:[className:linenumber] message` |


## πŸš€ Usage

- ### Show only 'message'

**`Log.v([String]);`**
```dart
Log.v("message");
Log.i("message");
Log.d("message");
Log.w("message");
Log.e("message");
```
#### iOS & Others
> image

#### Android
> image


- ### Show 'message' & 'path'
**`Log.v([String], path: [Boolean])`**
```dart
Log.v("message", path: true);
Log.i("message", path: true);
Log.d("message", path: true);
Log.w("message", path: true);
Log.e("message", path: true);
```

#### iOS & Others
> image

#### Android
> image


- ### Show 'message' & 'tag'
**`Log.v([String], tag: [String])`**
```dart
Log.v("message", tag: "FlutterLogcat");
Log.i("message", tag: "FlutterLogcat");
Log.d("message", tag: "FlutterLogcat");
Log.w("message", tag: "FlutterLogcat");
Log.e("message", tag: "FlutterLogcat");
```

#### iOS & Others
> image

#### Android
> image


- ### Show 'message' & 'time'
**`Log.v([String], time: [String])`**
```dart
Log.v("message", time: true);
Log.i("message", time: true);
Log.d("message", time: true);
Log.w("message", time: true);
Log.e("message", time: true);
```
#### iOS & Others
> image

#### Android
> image


## 🧭 Set Log Configure

It's okay if you don't declare this function.

You only need to use it when an overall setup is required.

> - visible

> - tag

> - time

- #### Control VisibleπŸ‘€ to Log.
**`Log.configure(visible: [Boolean])`**
```dart
import 'package:flutter/foundation.dart';

Log.configure(visible: kDebugMode);
```
- #### If you want setting default `tag`
**`Log.configure(visible: [Boolean], tag: [String])`**
```dart
Log.configure(visible: kDebugMode, tag: "FlutterLogcat");

Log.v(...);
Log.i(...);
...
```
> ![image](https://github.com/b3lon9/flutter_logcat/assets/119420119/db63624a-1cb5-4fa7-b144-73d2fb888c94)

- #### If you want to see time this
**`Log.configure(visible: [Boolean], time: [Boolean])`**
```dart
Log.configure(visible: true, time: true);
```
> image


## πŸ“Ž Service, Background Functions
```dart
Log.s("message from service");
Log.x("message from background");
```
#### iOS & Others
> image

#### Android
> image


## πŸŒ€ Stream Logcat messages
```dart
final subscription = Log.stream.listen(
(message) => print('message:$message'), // Save Log Record.
);
```

#### Stop Stream
```dart
Log.stopStream(); // or `dispose()` function.
```