gpt4 book ai didi

没有 "log.xxxx"的 Scala 调用记录方法

转载 作者:行者123 更新时间:2023-12-02 08:43:01 24 4
gpt4 key购买 nike

有没有一种方法可以在不必手动定义日志记录方法的情况下执行以下操作,例如定义错误:

object FooBar {
lazy val log = LoggerFactory.getLogger("AndroidProxy")
def error(msg: String) = log.error(msg)


def my_method(): Unit = {
error("This is an error!")
}
}

最佳答案

替换 def error
import log.error

关于没有 "log.xxxx"的 Scala 调用记录方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14905834/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com