Skip to content

Commit

Permalink
automatically trim log messages
Browse files Browse the repository at this point in the history
  • Loading branch information
qimiko committed Jan 23, 2024
1 parent 5900064 commit 665756d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ fun LogCard(logLine: LogLine, modifier: Modifier = Modifier) {
)

Text(
"[${logLine.tag}]: ${logLine.message}",
"[${logLine.tag}]: ${logLine.messageTrimmed}",
fontFamily = FontFamily.Monospace,
style = Typography.bodyMedium
)
Expand Down
4 changes: 3 additions & 1 deletion app/src/main/java/com/geode/launcher/log/LogLine.kt
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,10 @@ data class LogLine(

val identifier = time.toJavaInstant()

val messageTrimmed by lazy { this.message.trim() }

val formattedTime by lazy { this.time.toLocalDateTime(TimeZone.currentSystemDefault()) }
val asSimpleString by lazy {
"$formattedTime [${this.priority.toChar()}/${this.tag}]: ${this.message}"
"$formattedTime [${this.priority.toChar()}/${this.tag}]: ${this.messageTrimmed}"
}
}

0 comments on commit 665756d

Please sign in to comment.