Logger in canton console
- kctamOP
Hi team,
I see some examples in the canton doc that
loggeris used. When I use this I see it’s not found.cmd4.sc:1: not found: type ConsoleEnvironment def pruneAllNodes(pruneUpToIncluding: CantonTimestamp)(implicit env: ConsoleEnvironment): Unit = { ^ cmd4.sc:16: not found: value logger logger.warn( ^ cmd4.sc:26: not found: value logger case None => logger.info(s"Nothing to prune up to ${pruneUpToIncluding}") ^ Compilation FailedPlease advise where I can use
logger.Thanks in advance.
kc
- Mate_Varga 1
Hi KC
You should be able to use a logger in any canton console environment, but it is not available by default.
First import these to be able to grab a logger for your script:import com.digitalasset.canton.logging.NamedLoggerFactory import com.typesafe.scalalogging.LoggerThen produce the logger:
val loggerFactory = consoleEnvironment.environment.loggerFactory val logger = Logger(loggerFactory.getLogger(this.getClass))ConsoleEnvironment is also available after you import it:
import com.digitalasset.canton.console.{ConsoleEnvironment}Hope this helps,
Mate - kctam 1
Mate_Varga:import com.digitalasset.canton.console.{ConsoleEnvironment}Hi Mate,
Thanks for your reply. As I see a lot of examples whereloggeris used, see if the doc can mention this somewhere.
cheers,
kc