init static method

void init({
  1. Level level = Level.ALL,
})

Initializes the logger with the desired log level.

Call this early in your app to control which logs are printed. In release/production builds, use Level.OFF to silence all output or Level.SEVERE to only show errors.

If not called, defaults to Level.ALL (everything is printed).

// Production: silence all logs
Log.init(level: Level.OFF);

// Production: only errors and fatal
Log.init(level: Level.SEVERE);

// Development (default)
Log.init(level: Level.ALL);

Implementation

static void init({Level level = Level.ALL}) {
  _level = level;
  Logger.root.level = level;
}