MethodChannelPdLog class

基于 MethodChannel 的平台实现。

负责通过名为 pd_log 的通道与原生平台交互:

  • 获取平台版本;
  • 透传日志(控制台输出与文件写入由原生侧决定);
  • 配置原生文件日志缓冲;
  • 执行缓冲区刷新与文件管理操作。
Inheritance

Constructors

MethodChannelPdLog.new()

Properties

hashCode int
The hash code for this object.
no setterinherited
methodChannel MethodChannel
The method channel used to interact with the native platform.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

configureFileLogging({required bool enabled, int? flushIntervalMs, int? maxBufferEntries, int? maxBufferBytes}) Future<void>
配置原生文件日志缓冲策略,包括刷新间隔与缓冲上限。
override
deleteAllLogs() Future<int>
删除全部日志文件,返回删除数量。
override
deleteLogFile(String path) Future<bool>
删除指定路径的日志文件。
override
flushLogs() Future<void>
请求原生侧立即刷新缓冲区到磁盘。
override
getLogRootPath() Future<String?>
获取原生侧日志根目录路径。
override
getPlatformVersion() Future<String?>
调用原生方法 getPlatformVersion 获取平台版本字符串。
override
listLogFiles() Future<List<Map<String, dynamic>>>
列出所有日志文件及其元信息。
override
listYearFolders() Future<List<String>>
列出日志根目录下的一级年份目录(不递归子级)。
override
log({required String level, required String message, String? tag, bool printToConsole = true, bool writeToFile = true}) Future<void>
通过 pd_log 通道向原生发送日志消息。
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited