IsolateFileLogHandler constructor
IsolateFileLogHandler(})
Create a new instance of IsolateFileLogHandler.
logNamePrefix
will be used as prefix for each log file created by the
instance of this IsolateFileLogHandler.
It's recommended that the logNamePrefix
be unique in the app.
maxLogSizeInMb
will be used to be deleted old log files.
If in the logFileDirectory
there's files with prefix logNamePrefix
and the count of files is greater than maxFilesCount
, older files will
be deleted.
logFileDirectory
is the directory where log files will be stored.
We assume that the logFileDirectory
provided exist in the file system.
supportedLevels
will be used to discard BDLogRecord with
BDLevel lower than supportedLevels
.
Implementation
IsolateFileLogHandler(
this.logFileDirectory, {
this.maxFilesCount = 5,
this.logNamePrefix = '_log',
this.maxLogSizeInMb = 5,
this.supportedLevels = const <BDLevel>[
BDLevel.warning,
BDLevel.success,
BDLevel.error,
],
}) : assert(
logNamePrefix.isNotEmpty,
'logNamePrefix should not be empty',
),
assert(
maxLogSizeInMb > 0,
'maxLogSizeInMb should not be lower than zero',
) {
_workerSendPort = _startLogging();
}