API Reference › Log › Log.level
method

Log.level

Log.level() -> int

Returns the current logging threshold — the minimum level that Log.set_level last set (0 by default). Use it to branch on how verbose logging is: skip building an expensive debug string when it would be dropped anyway, or show an in-game indicator that verbose logging is on. The levels are trace 0 through error 4.

Example

program Level {
  entry {
    print(Log.level())        # 0
    Log.set_level(2)
    print(Log.level())        # 2
  }
}
← All symbols