Skip to content

jawa0919/flutter_w_log

Repository files navigation

flutter_w_log

Pub package GitHub issues

Language: English | 中文简体

A simple and reliable logging solution. Quick positioning, persistent storage, and convenient export.

Getting started

In your project pubspec.yaml file add

dependencies:
  #####
  flutter_w_log: ">=0.0.0 <1.0.0"
  #####

Features

  • Quick localization: The console log contains a line count link, which can be directly clicked to locate the code location. It supports VSCode/AndroidStudio
  • Extra long log: When the log length exceeds 999 characters, it will automatically wrap to ensure that the log content is not lost
  • Persistent save: Logs will be saved to the database, persistent data, supported across all platforms
  • Encrypted storage: Supports encrypting and storing log information in the database
  • Convenient export: Local log data can be exported to a specified file location, with customizable time periods, log levels, output formats, etc
and ios
and ios

Usage

WLog.d("This is D(DEBUG) Log");
WLog.i("This is I(INFO) Log");
WLog.w("This is W(WARN) Log");
WLog.e("This is E(ERROR) Log");
/// before
debugPrint("debugPrint string");
print("print object");

/// after
WLog.debugPrint("debugPrint string");
WLog.print("print object");
// or
debugPrintWLog("debugPrint string");
printWLog("print object");

Export

/// today
WLogExport.todayLog2File(exportDirectory);
/// all
WLogExport.allLog2File(exportDirectory, [WLogLevel.DEBUG]);
/// time
WLogExport.timeLog2File(exportDirectory, start, end, levelList)

Custom Export

// Custom Path
Directory? directory = await getApplicationDocumentsDirectory();
final logFilePath = join(directory!.path, "customLog.txt");
// Custom DateTime
final end = DateTime.parse("2024-03-29 10:27:42");
final start = DateTime.parse("2024-03-17 22:44:10");
// Custom WLogLevel
List<WLogLevel> levelList = [WLogLevel.DEBUG, WLogLevel.INFO];
// export
WLog.log2File(logFilePath, start, end, levelList);

Thanks

f_logs

Other

You are welcome to put forward your ideas and feedback issues