Skip to content
Dan M edited this page Mar 31, 2022 · 6 revisions

Log contains an extended console logger with colours and varying log levels.


API

Enums

Level

The various levels that the logger can log at. Logs will be coloured and include an icon based on the level.

Value Colour Icon
info Blue Icons.lightbulb
warning Yellow Icons.warning
error Red Icons.error
debug Green Icons.bug_report
nothing N/A N/A
Setting the logger to Level.nothing will disable logs.

Static Methods

static void showLogger(BuildContext context)

Brings up a page in app that shows the console output.

Constructor

Log(String name, {Level level, bool colors})

Creates a new Log with name. level sets the initial log level of the Log, and setting colors to false disables colours. level defaults to Level.info and colors defaults to true.

Methods

void log(dynamic message, [Error? error, StackTrace? stackTrace])

Logs message to the console, at the currently set Level. Optional errors and stacktraces can be included with error and stackTrace

void logAt(Level level, dynamic message, [Error? error, StackTrace? stackTrace])

Same as log, but you can set the Level through level.

void info(dynamic message, [Error? error, StackTrace? stackTrace])

Calls logAt at Level.info.

void warning(dynamic message, [Error? error, StackTrace? stackTrace])

Calls logAt at Level.warning.

void error(dynamic message, [Error? error, StackTrace? stackTrace])

Calls logAt at Level.error.

void debug(dynamic message, [Error? error, StackTrace? stackTrace])

Calls logAt at Level.debug.

setLogInDebugMode(bool log)

If log is set to true, logs will still show up even when the app is not in debug mode.

setMaxLogs(int maxLogs)

Sets the amount of logs that will be shown in the in-app console

Getters

Clone this wiki locally