Loggable class abstract
Loggable provides the ability to object to be logged as part of logging context field set.
Example:
class User implements Loggable {
final String name;
final String email;
final DateTime createdAt;
User({this.name, this.email, this.createdAt});
@override
Iterable<Field> toFields() =>
{
Str('name', name),
Str('email', email),
DTM('createdAt', createdAt),
};
}
final user = User(
name: 'Roman Vanesyan',
email: 'roman@vanesyan.me',
createdAt: DateTime.now());
logger
.bind(Obj('user', user), DTM('authenticatedAt', DateTime.now()))
.info('successfully authenticated');
Constructors
- Loggable()
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toFields(
) → Iterable< Field> -
Marshals this class to set of
Field
s. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited