Log class
Provides an implementation for Logger.onRecord
.
When a message is added to Logger
, report is automatically called and
ReportRecord filtered by filter is added to reports.
Filters can be added with addFilter or ignoreType. If a filter returns null, that record is ignored.
You can add a filter that changes the log level of records that match regular
expressions in the remote config (patapataLogLevelFilters
).
Example: Firebase Remote Config
{
'foo': 800,
'bar': 1000
}
Each filter is processed from the top.
The log level to be processed can be set in LogEnvironment.logLevel or
in the remote config (patapata_log_level
).
(default is Level.INFO
)
If settings are made in both LogEnvironment.logLevel and the remote config, the remote config setting takes precedence.
This class is automatically initialized during the initialization of patapata App and can be accessed from App.log.
Properties
-
app
→ App<
Object> -
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- level ↔ Level
-
The level of the log to be processed.
getter/setter pair
- logPrinting ↔ bool
-
If true, the log contents will be output on the debug console and system log.
getter/setter pair
-
reports
→ Stream<
ReportRecord> -
Returns the stream of ReportRecord processed by report.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
addFilter(
ReportRecordFilter test) → void - Adds a filter.
-
dispose(
) → void - Releases each resource.
-
filter(
ReportRecord object) → ReportRecord? -
Filters
object
and returns the result. -
ignoreType(
Type type) → void -
Adds a filter to ignore if ReportRecord.error matches
type
. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
removeFilter(
ReportRecordFilter test) → void - Removes the filter added with addFilter.
-
report(
ReportRecord record) → void -
Filters
record
and adds the result to reports. If the filter returns null, that record is ignored. -
setLevelByValue(
int value) → void -
Specifies the level of the log to be processed using
Level.value
. -
toString(
) → String -
A string representation of this object.
inherited
-
unignoreType(
Type type) → void - Removes the filter added with ignoreType.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Constants
- kFlutterErrorMechanism → const String
- kNativeMechanism → const String
- kRemoteConfigLevelFilters → const String
- kReportMechanism → const String
- kRootLogMechanism → const String
- kUnhandledErrorMechanism → const String