max log message length to store in db

This commit is contained in:
julian 2023-01-16 08:34:52 -06:00
parent 09b51def04
commit 3d4d57a97c

View file

@ -49,9 +49,16 @@ class Logging {
Logger.print(object, normalLength: !printFullLength);
return;
}
String message = object.toString();
// random value to check max size of message before storing in db
if (message.length > 20000) {
message = "${message.substring(0, 20000)}...";
}
final now = core.DateTime.now().toUtc();
final log = Log()
..message = object.toString()
..message = message
..logLevel = level
..timestampInMillisUTC = now.millisecondsSinceEpoch;
if (level == LogLevel.Error || level == LogLevel.Fatal) {