RES-74 Ajout du multiligne sur les logs des analytics
Some checks failed
openium/resgen.swift/pipeline/head There was a failure building this commit
Some checks failed
openium/resgen.swift/pipeline/head There was a failure building this commit
This commit is contained in:
@@ -196,63 +196,74 @@ enum AnalyticsGenerator {
|
||||
}
|
||||
|
||||
private static func getPrivateLogFunction() -> String {
|
||||
"""
|
||||
// MARK: - Private Log Methods
|
||||
"""
|
||||
// MARK: - Private Log Methods
|
||||
|
||||
private func logScreen(
|
||||
name: String,
|
||||
path: String,
|
||||
params: [String: Any]?
|
||||
) {
|
||||
guard isEnabled else {
|
||||
if isDebugMode {
|
||||
logger.log("Analytics disabled")
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
managers.values.forEach { manager in
|
||||
|
||||
if isDebugMode {
|
||||
logger.debug("🖥️ Screen: \\(name, privacy: .public) | Path: \\(path, privacy: .public) | Params: \\(String(describing: params ?? [:]), privacy: .public)")
|
||||
}
|
||||
|
||||
manager.logScreen(
|
||||
name: name,
|
||||
path: path,
|
||||
params: params
|
||||
)
|
||||
private func logScreen(
|
||||
name: String,
|
||||
path: String,
|
||||
params: [String: Any]?
|
||||
) {
|
||||
guard isEnabled else {
|
||||
if isDebugMode {
|
||||
logger.log("Analytics disabled")
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
private func logEvent(
|
||||
name: String,
|
||||
action: String,
|
||||
category: String,
|
||||
params: [String: Any]?
|
||||
) {
|
||||
guard isEnabled else {
|
||||
if isDebugMode {
|
||||
logger.log("Analytics disabled")
|
||||
}
|
||||
return
|
||||
managers.values.forEach { manager in
|
||||
|
||||
if isDebugMode {
|
||||
logger.debug(\"""
|
||||
🖥️ Screen:
|
||||
Name: \\(name, privacy: .public)
|
||||
Path: \\(path, privacy: .public)
|
||||
Params: \\(String(describing: params ?? [:]), privacy: .public)
|
||||
\""")
|
||||
}
|
||||
|
||||
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)")
|
||||
}
|
||||
|
||||
manager.logEvent(
|
||||
name: name,
|
||||
action: action,
|
||||
category: category,
|
||||
params: params
|
||||
)
|
||||
}
|
||||
manager.logScreen(
|
||||
name: name,
|
||||
path: path,
|
||||
params: params
|
||||
)
|
||||
}
|
||||
"""
|
||||
}
|
||||
|
||||
private func logEvent(
|
||||
name: String,
|
||||
action: String,
|
||||
category: String,
|
||||
params: [String: Any]?
|
||||
) {
|
||||
guard isEnabled else {
|
||||
if isDebugMode {
|
||||
logger.log("Analytics disabled")
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
managers.values.forEach { manager in
|
||||
|
||||
if isDebugMode {
|
||||
logger.debug(\"""
|
||||
📊 Event:
|
||||
Name: \\(name, privacy: .public)
|
||||
Action: \\(action.isEmpty ? "-" : action, privacy: .public)
|
||||
Category: \\(category.isEmpty ? "-" : category, privacy: .public)
|
||||
Params: \\(String(describing: params ?? [:]), privacy: .public)
|
||||
\""")
|
||||
}
|
||||
|
||||
manager.logEvent(
|
||||
name: name,
|
||||
action: action,
|
||||
category: category,
|
||||
params: params
|
||||
)
|
||||
}
|
||||
}
|
||||
"""
|
||||
}
|
||||
|
||||
private static func getAnalyticsProperties(
|
||||
|
||||
Reference in New Issue
Block a user