log top-level constant Null safety

_Log const log

Adds a log record for a message at a particular logLevel if isLoggable(logLevel) is true.

Use this method to create log entries for user-defined levels. To record a message at a predefined level (e.g. LogLevel.INFO, LogLevel.WARNING, etc) you can use their specialized methods instead (e.g. info, warning, etc).

If message is a Function, it will be lazy evaluated. Additionally, if message or its evaluated value is not a String, then 'toString()' will be called on the object and the result will be logged.

All messages will be printed when in debug mode. In profile mode, all messages LogLevel.WARNING and more severe will be printed. In release mode, no messages will be printed. This can be overridden by setting a different log.level.


const log = _Log();