Shaburger constructor
Factory constructor allowing to parametrized the next call to logging
name
: the name of the logger, also the key inside loggers, if no name is given default to main
prefix
: the prefix for each logged line
logToFile
: Logging will be also written to file (sync)
path
: if logToFile
is true
, this allow to indicate the path where to write the log
filename
: if logToFile
is true
, this allow to indicate the name of the log file
Implementation
factory Shaburger(
{String name = _baseName,
bool logToFile = false,
String? path,
String? filename}) {
if (_instances.containsKey(name)) {
return _instances[name]!;
} else {
Shaburger instance = Shaburger._(
name: name, logToFile: logToFile, path: path, filename: filename);
_instances[name] = instance;
return instance;
}
}