setCategories static method
Sets up categories for the specified logger.
Categories are divided into two types: select and exclude.
selectcategories specify which categories to include, optionally with a minimum level in parentheses. Example:network(warning)selects thenetworkcategory with a minimum level ofwarning. If no level is specified, the default level is the lowest,info. Example:coreimpliescore(info).excludecategories specify which categories to exclude, prefixed with a-, optionally with a maximum level in parentheses. Example:-core(error)excludes thecorecategory up to theerrorlevel. If no level is specified, the default level is the highest,fatal. Example:-coreimplies-core(fatal).- To selectively remove a category entirely, use the
nonelevel. Examples:-core(none)ornetwork(none).
Usage examples:
Log.setCategories('network(warning), core, -core(error)', clear: true);
Log.setCategories('-core(none)');
categories: A comma-separated list of categories.logger: The logger name (defaults to"Main").clear: Iftrue, clears both theselectandexcludecategory lists (defaults tofalse).
Returns: A LogError indicating success or failure.
Implementation
static LogError setCategories(String categories,
{String logger = 'Main', bool clear = false}) {
return isCriticalMode
? LogError(-5, message: 'is in critical mode')
: loggerManager.setCategories(categories, logger: logger, clear: clear);
}