RES-75 Ajouter un pretty print pour le dictionnaire des params
Some checks failed
openium/resgen.swift/pipeline/pr-master There was a failure building this commit
openium/resgen.swift/pipeline/head There was a failure building this commit

This commit is contained in:
2025-10-29 09:44:19 +01:00
parent 1f9af76b40
commit 4b944ed8c7
3 changed files with 42 additions and 12 deletions

View File

@@ -160,6 +160,17 @@ internal class AnalyticsManager {
// MARK: - Private Log Methods
private func formattedParams(_ params: [String: Any]?) -> String {
guard let params = params, !params.isEmpty else { return "-" }
let formattedParams = params.map { key, value in
" \(key): \(value)"
}
.joined(separator: "\n")
return "\n" + formattedParams
}
private func logScreen(
name: String,
path: String,
@@ -175,7 +186,12 @@ internal class AnalyticsManager {
managers.values.forEach { manager in
if isDebugMode {
logger.debug("🖥️ Screen: \(name, privacy: .public) | Path: \(path, privacy: .public) | Params: \(String(describing: params ?? [:]), privacy: .public)")
logger.debug("""
🖥️ Screen:
Name: \(name, privacy: .public)
Path: \(path, privacy: .public)
Params: \(self.formattedParams(params), privacy: .public)
""")
}
manager.logScreen(
@@ -202,7 +218,13 @@ internal class AnalyticsManager {
managers.values.forEach { manager in
if isDebugMode {
logger.debug("📊 Event: \(name, privacy: .public) | Action: \(action.isEmpty ? "-" : action, privacy: .public) | Category: \(category.isEmpty ? "-" : category, privacy: .public) | Params: \(String(describing: params ?? [:]), privacy: .public)")
logger.debug("""
📊 Event:
Name: \(name, privacy: .public)
Action: \(action.isEmpty ? "-" : action, privacy: .public)
Category: \(category.isEmpty ? "-" : category, privacy: .public)
Params: \(self.formattedParams(params), privacy: .public)
""")
}
manager.logEvent(