Skip to content

Commit

Permalink
Update log entry style
Browse files Browse the repository at this point in the history
  • Loading branch information
vishnuravi committed Nov 10, 2024
1 parent d973cd7 commit 7d62185
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 16 deletions.
4 changes: 4 additions & 0 deletions LifeSpace.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
634E38442CDE6E2B00B16E20 /* LogViewer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 634E38432CDE6E2900B16E20 /* LogViewer.swift */; };
634E38482CDE7A7400B16E20 /* LogLevel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 634E38472CDE7A7100B16E20 /* LogLevel.swift */; };
634E38542CE055CC00B16E20 /* OSLogEntryLog+FormattedLogOutput.swift in Sources */ = {isa = PBXBuildFile; fileRef = 634E38532CE055C300B16E20 /* OSLogEntryLog+FormattedLogOutput.swift */; };
634E38562CE0EA4600B16E20 /* LogsListView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 634E38552CE0EA4600B16E20 /* LogsListView.swift */; };
634FFF672C169F40005E8217 /* LifeSpaceConsent.swift in Sources */ = {isa = PBXBuildFile; fileRef = 634FFF662C169F40005E8217 /* LifeSpaceConsent.swift */; };
634FFF6D2C16B81A005E8217 /* HIPAAAuthorization.swift in Sources */ = {isa = PBXBuildFile; fileRef = 634FFF6C2C16B81A005E8217 /* HIPAAAuthorization.swift */; };
635198792CD53FF40087B1F3 /* FirebaseConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 635198782CD53FF10087B1F3 /* FirebaseConfiguration.swift */; };
Expand Down Expand Up @@ -145,6 +146,7 @@
634E38432CDE6E2900B16E20 /* LogViewer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LogViewer.swift; sourceTree = "<group>"; };
634E38472CDE7A7100B16E20 /* LogLevel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LogLevel.swift; sourceTree = "<group>"; };
634E38532CE055C300B16E20 /* OSLogEntryLog+FormattedLogOutput.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "OSLogEntryLog+FormattedLogOutput.swift"; sourceTree = "<group>"; };
634E38552CE0EA4600B16E20 /* LogsListView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LogsListView.swift; sourceTree = "<group>"; };
634FFF662C169F40005E8217 /* LifeSpaceConsent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LifeSpaceConsent.swift; sourceTree = "<group>"; };
634FFF6C2C16B81A005E8217 /* HIPAAAuthorization.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HIPAAAuthorization.swift; sourceTree = "<group>"; };
635198782CD53FF10087B1F3 /* FirebaseConfiguration.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FirebaseConfiguration.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -317,6 +319,7 @@
634E38472CDE7A7100B16E20 /* LogLevel.swift */,
634E38412CDE6B3B00B16E20 /* LogManager.swift */,
634E38432CDE6E2900B16E20 /* LogViewer.swift */,
634E38552CE0EA4600B16E20 /* LogsListView.swift */,
);
path = Debug;
sourceTree = "<group>";
Expand Down Expand Up @@ -655,6 +658,7 @@
2FE5DC3A29EDD7CA004B9AB4 /* Welcome.swift in Sources */,
634FFF672C169F40005E8217 /* LifeSpaceConsent.swift in Sources */,
634E38482CDE7A7400B16E20 /* LogLevel.swift in Sources */,
634E38562CE0EA4600B16E20 /* LogsListView.swift in Sources */,
2FE5DC3829EDD7CA004B9AB4 /* InterestingModules.swift in Sources */,
2FE5DC3529EDD7CA004B9AB4 /* Consent.swift in Sources */,
630D3B572C616E9D006066E5 /* WithdrawView.swift in Sources */,
Expand Down
15 changes: 2 additions & 13 deletions LifeSpace/Debug/LogViewer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,21 +41,10 @@ struct LogViewer: View {

if isLoading {
Spacer()
ProgressView("LOADING_LOGS")
.padding()
ProgressView("LOADING_LOGS").padding()
Spacer()
} else {
if !logs.isEmpty {
List(logs, id: \.self) { entry in
VStack(alignment: .leading) {
Text(entry.date.formatted())
Text("Category: \(entry.category)")
Text(entry.composedMessage)
}
}
} else {
ContentUnavailableView("NO_LOGS_AVAILABLE", systemImage: "magnifyingglass")
}
LogsListView(logs: logs)
}

Spacer()
Expand Down
34 changes: 34 additions & 0 deletions LifeSpace/Debug/LogsListView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
//
// LogsListView.swift
// LifeSpace
//
// Created by Vishnu Ravi on 11/10/24.
//

import OSLog
import SwiftUI


struct LogsListView: View {
var logs: [OSLogEntryLog]

var body: some View {
if !logs.isEmpty {
List(logs, id: \.self) { entry in
VStack(alignment: .leading) {
Text(entry.date.formatted())
.font(.caption)
Text(entry.category)
.font(.caption)
.fontWeight(.semibold)
.padding(2)
.background(Color(.systemGray5))
.cornerRadius(4)
Text(entry.composedMessage)
}
}
} else {
ContentUnavailableView("NO_LOGS_AVAILABLE", systemImage: "magnifyingglass")
}
}
}
3 changes: 0 additions & 3 deletions LifeSpace/Resources/Localizable.xcstrings
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,6 @@
}
}
}
},
"Category: %@" : {

},
"CLOSE" : {
"comment" : "MARK: General",
Expand Down

0 comments on commit 7d62185

Please sign in to comment.