Site icon Flutter Packages | Pub dev Packages – Flutter Mobile App World

Simple, pretty and powerful logger for flutter

flutter_logger

Download

flutter_easylogger: ^{LAST_VERSION}

Usage

Logger.d("hello");

Output

Options

no tag

Logger.v("hello world");
Logger.d("hello world");
Logger.i("hello world");
Logger.w("hello world");
Logger.e("hello world");
var json = "{\"name\":\"tom\",\"age\":\"18\"}";
Logger.json(json);

with tag

Logger.d("hello",tag:"TAG");

Json support (output will be in debug level)

Logger.json(json);

jumps to the printed file details page

Advanced

Logger.init(
    true,// isEnable ,if production ,please false
    isShowFile: true, // In the IDE, whether the file name is displayed
    isShowTime: true, // In the IDE, whether the time is displayed
    isShowNavigation: true, // In the IDE, When clicked, it jumps to the printed file details page
    levelVerbose: 247, // In the IDE, Set the color
    levelDebug: 26,
    levelInfo: 28,
    levelWarn: 3,
    levelError :  9 ,
    phoneVerbose: Colors.white54, // In your phone or web,, Set the color
    phoneDebug: Colors.blue,
    phoneInfo: Colors.green,
    phoneWarn: Colors.yellow,
    phoneError: Colors.redAccent,
  );

You can change the color of level, and the value is in the range of 0-255. Please refer to the picture below for details

print on the phone

Logs can be printed on the phone or filtered by log level or keyword

// add Overlay
ConsoleOverlay.show(context);
// remoove
ConsoleOverlay.remove();

Note

Turn off logging when production

Logger.init(false);
IOSIOSAndroidWeb
ide colornoyesyes
phone coloryesyesyes

Download flutter logger source code on GitHub

https://github.com/niezhiyang/flutter_logger

Exit mobile version
Skip to toolbar