Console

interface Console : Variable

控制台用于在脚本运行过程中输出日志信息, 功能类似与浏览器的 console 对象, 日志信息具有不同的等级, 可以根据需要选择不同的等级.

Author

M8Test, [email protected], https://m8test.com

Functions

Link copied to clipboard
abstract fun addListener(listener: Listener): Result

添加日志监听器.

Link copied to clipboard
abstract fun assertFalse(value: Boolean, vararg data: Any?)

输出等级为 assert 的日志信息.

Link copied to clipboard
abstract fun assertTrue(value: Boolean, vararg data: Any?)

输出等级为 assert 的日志信息.

Link copied to clipboard
abstract fun clear()

清空所有已经输出的日志信息.

Link copied to clipboard
abstract fun count(label: String?)

count 方法会记录调用 count 的次数.

Link copied to clipboard
abstract fun countReset(label: String?)

重置计数器, 此函数有一个可选参数 label .

Link copied to clipboard
abstract fun error(vararg data: Any?)

输出等级为 error 的日志信息.

Link copied to clipboard
abstract fun getGlobalName(): String

获取作为全局变量时的名称.

Link copied to clipboard
abstract fun getPublicType(): Type

获取 Variable 注入到脚本时需要显示的类型.

Link copied to clipboard
abstract fun info(vararg data: Any?)

输出等级为 info 的日志信息.

Link copied to clipboard
abstract fun isPrefixRequired(): Boolean

是否需要添加前缀, 每种编程语言添加的前缀不一样, 前缀可以通过 Language.getVariablePrefix 获取.

Link copied to clipboard
abstract fun isSuffixRequired(): Boolean

是否需要添加后缀, 每种编程语言添加的后缀不一样, 后缀可以通过 Language.getVariableSuffix 获取.

Link copied to clipboard
abstract fun log(vararg data: Any?)

输出等级为 log 的日志信息.

Link copied to clipboard
abstract fun removeListener(listener: Listener): Result

移除日志监听器.

Link copied to clipboard
abstract fun time(label: String?)

启动一个计时器来跟踪某一个操作的占用时长.

Link copied to clipboard
abstract fun timeEnd(label: String?)

停止一个通过 time 启动的计时器.

Link copied to clipboard
abstract fun verbose(vararg data: Any?)

输出等级为 verbose 的日志信息.

Link copied to clipboard
abstract fun warn(vararg data: Any?)

输出等级为 warn 的日志信息.