Log class
Used to print logs in the console according to the severity level of the logging text.
Log instance can be created by providing a tag, which is used to separate log instances. You can't create two instances with the same tag.
class UserRepository {
// Create a instance of the log with a tag
static final log = Log("UserRepository");
Future<void> add(Item item) async {
log.d("Adding the item with name: ${item.name});
// ...
}
}
By changing the level of the Log instance, you can decide the severity level that is printed. Default value is debug. That means every log that has severity level of debug or higher will be printed.
Severity level from higher to lower can be ordered as follows
- Annotations
Constructors
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- tag → String
-
tag is given while creating a instance of the Log.
If a instance has previously created with the same tag, the same
instance will be return. Else new instance will be created.
final
Methods
-
d(
String message) → void -
Used to log a
message
with debug severity level. -
e(
String message) → void -
Used to log a
message
with error severity level. -
i(
String message) → void -
Used to log a
message
with info severity level. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
w(
String message) → void -
Used to log a
message
with warn severity level.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited