AppLog class
A drop-in replacement for Logger — same constructor parameters
(filter, printer, output, level) and the same log methods
(t, d, i, w, e, f, log) — that also forwards every event to
the HTTP inspector's Logs tab, with an optional tag you can filter
by there.
final log = AppLog();
log.i('User signed in', tag: 'Auth');
log.e('Request failed', tag: 'Network', error: e, stackTrace: s);
Whatever you'd normally pass to Logger — a custom printer, filter,
or output (e.g. a file output) — works the same way here; AppLog
prints/writes through it exactly like Logger would, in addition to
populating the Logs tab.
Unlike the rest of this package, AppLog is not disabled in release
builds (there's no kDebugMode/kProfileMode guard around it) — it's a
general-purpose logger, so it keeps printing/writing through your
output in release too. It does print a one-time warning via
debugPrint the first time an AppLog is constructed in a release
build, as a nudge to guard usage yourself if that's not what you want.
Constructors
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
-
init
→ Future<
void> -
Future indicating if the initialization of the
filter,printerandoutputhas finished. Only relevant if any of them doasyncwork in theirinit().no setter - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
close(
) → Future< void> -
Closes this logger and releases the
filter/printer/output. -
d(
dynamic message, {DateTime? time, Object? error, StackTrace? stackTrace, String? tag}) → void -
Log a message at level
Level.debug. -
e(
dynamic message, {DateTime? time, Object? error, StackTrace? stackTrace, String? tag}) → void -
Log a message at level
Level.error. -
f(
dynamic message, {DateTime? time, Object? error, StackTrace? stackTrace, String? tag}) → void -
Log a message at level
Level.fatal. -
i(
dynamic message, {DateTime? time, Object? error, StackTrace? stackTrace, String? tag}) → void -
Log a message at level
Level.info. -
isClosed(
) → bool -
log(
Level level, dynamic message, {DateTime? time, Object? error, StackTrace? stackTrace, String? tag}) → void -
Log a message with
level, optionally tagged withtagso it can be filtered by tag in the inspector's Logs tab. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
t(
dynamic message, {DateTime? time, Object? error, StackTrace? stackTrace, String? tag}) → void -
Log a message at level
Level.trace. -
toString(
) → String -
A string representation of this object.
inherited
-
v(
dynamic message, {DateTime? time, Object? error, StackTrace? stackTrace, String? tag}) → void -
w(
dynamic message, {DateTime? time, Object? error, StackTrace? stackTrace, String? tag}) → void -
Log a message at level
Level.warning. -
wtf(
dynamic message, {DateTime? time, Object? error, StackTrace? stackTrace, String? tag}) → void
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited