mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-11-17 17:57:40 +00:00
max log message length to store in db
This commit is contained in:
parent
09b51def04
commit
3d4d57a97c
1 changed files with 8 additions and 1 deletions
|
@ -49,9 +49,16 @@ class Logging {
|
||||||
Logger.print(object, normalLength: !printFullLength);
|
Logger.print(object, normalLength: !printFullLength);
|
||||||
return;
|
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 now = core.DateTime.now().toUtc();
|
||||||
final log = Log()
|
final log = Log()
|
||||||
..message = object.toString()
|
..message = message
|
||||||
..logLevel = level
|
..logLevel = level
|
||||||
..timestampInMillisUTC = now.millisecondsSinceEpoch;
|
..timestampInMillisUTC = now.millisecondsSinceEpoch;
|
||||||
if (level == LogLevel.Error || level == LogLevel.Fatal) {
|
if (level == LogLevel.Error || level == LogLevel.Fatal) {
|
||||||
|
|
Loading…
Reference in a new issue