PdLogWeb class
pd_log 的 Web 平台实现。
设计要点:
- Web 环境无原生文件系统,所有“文件相关”方法皆为空实现;
- 日志输出直接使用浏览器控制台(
print
),不依赖MethodChannel
; writeToFile
参数在 Web 中被忽略,仅保留语义一致性;getPlatformVersion
返回浏览器 UA 字符串,便于调试环境信息。 Web 端平台实现:无需 MethodChannel,直接在控制台输出日志。
- Inheritance
-
- Object
- PlatformInterface
- PdLogPlatform
- PdLogWeb
Constructors
- PdLogWeb.new()
- Constructs a PdLogWeb
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- 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> -
配置原生文件日志(Web 端无效,空实现)。
override
-
deleteAllLogs(
) → Future< int> -
删除全部日志(Web 端不支持,返回 0)。
override
-
deleteLogFile(
String path) → Future< bool> -
删除指定日志文件(Web 端不支持,返回 false)。
override
-
flushLogs(
) → Future< void> -
刷新原生缓冲到磁盘(Web 端无效,空实现)。
override
-
getLogRootPath(
) → Future< String?> -
获取日志根路径(Web 端不支持,返回 null)。
override
-
getPlatformVersion(
) → Future< String?> -
返回包含平台版本信息的字符串(浏览器 UA)。
override
-
listLogFiles(
) → Future< List< Map< >String, dynamic> > -
列出日志文件(Web 端不支持,返回空列表)。
override
-
listYearFolders(
) → Future< List< String> > -
列出年份目录(Web 端不支持,返回空列表)。
override
-
log(
{required String level, required String message, String? tag, bool printToConsole = true, bool writeToFile = true}) → Future< void> -
在 Web 控制台输出日志。
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
Static Methods
-
registerWith(
Registrar registrar) → void - 在注册器中注册本平台实现,设置为默认实例。