[英]How can I log in Play Framework using Scala?
我將Play Framework更新至2.7,並收到以下警告:
method info in object Logger is deprecated (since 2.7.0): Create an instance of via Logger(...) and use the same-named method. Or use SLF4J directly.
所以我的問題是:
PS:
在不基於Play Framework的項目中,我曾經使用scala日志記錄 ,它是SLF4J的包裝。 這可以解決嗎?
Play 2.7為Scala提供了一個與scala記錄類似的特征。 它創建一個val
,您可以在類/對象中使用它:
import play.api.Logging
class MyClass extends Logging {
// `logger` is automaticaly defined by the `Logging` trait:
logger.info("hello!")
}
因此,還有另一種方法可以立即登錄Play。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.