lundi 21 décembre 2015

Reflect scala type of object, trait or class

In Scala-Play app, I want to use play.api.Logger.info(s"Message | $sessionID | ${this.getClass}"), where $sessionID is already defined and added to identify the user. $this.getClass - is not yet implemented and is my question - being in different places of code (objects, traits, classes), when logging something, I want to add information about the place in code where the log message occurred - that is I want to reflect on type of object, trait or class that called the logger. What would be the easiest way to do so in Scala?





Aucun commentaire:

Enregistrer un commentaire