Message constructor
Message(])
Implementation
Message(this.message,
this.severity,
this.tag,
this.stackTrace,
this.error,
this.function,
this.fileName,
this.lineNumber,
[Json? json]) : super(LogType.message, json) {
if (fileName == null) {
final stackTraceElement = StackTrace.current.toString();
final line = stackTraceElement.split('\n')[3];
final regex = RegExp(r'#\d+\s+(.+)\s+\((.+):(\d+):(\d+)\)');
final match = regex.firstMatch(line);
if (match != null) {
function = match.group(1);
fileName = match.group(2);
lineNumber = int.parse(match.group(3)!);
InnerLog().d('Function: $function FileName: $fileName LineNumber: $lineNumber');
}
if (tag == null || tag!.isEmpty) {
// get the substring from the first character to the first dot.
tag = fileName?.substring(0, fileName!.indexOf('.')) ?? '<unknown>';
}
}
}