Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: merge branch release/4.2.0 with master #86

Merged
merged 18 commits into from
Feb 4, 2025
Merged
Changes from 1 commit
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
149f78d
feat: Retrieve App and Device MetaData (SDKCF-6846)
SoumenRautray Nov 16, 2023
9f4835e
feat: declare event logger manager and public APIs (SDKCF-6845)
Esakkiraja-Pothikannan Nov 29, 2023
5c8900d
improve: Refactor event-logger code (SDKCF-6864)
anish-munirathinam Dec 22, 2023
97248eb
feat: Implement Network Manager Module (SDKCF-6849)
SoumenRautray Dec 26, 2023
58dd9a1
feat: Implement database manager (SDKCF-6848) (#67)
SoumenRautray Jan 4, 2024
d2c2674
chore: create public apis for Event Logger (SDKCF-6853)
SoumenRautray Jan 19, 2024
ab5cb69
feat: integrate Sample App for REvent Logger feature (SDKCF-6856)
Esakkiraja-Pothikannan Jan 22, 2024
8706df8
feat: add app lifecycle listener (SDKCF-6850)
Esakkiraja-Pothikannan Jan 22, 2024
0def630
feat: Implement Retry Mechanism (#71)
SoumenRautray Jan 22, 2024
d349784
improve: add real time error message in the default error (SDKCF-6856)
Esakkiraja-Pothikannan Jan 22, 2024
199304e
improve: refactor REvent parameters and log event Logic (SDKCF-6851) …
SoumenRautray Jan 24, 2024
077385b
improve: update sample app UI (SDKCF-6856)
Esakkiraja-Pothikannan Feb 7, 2024
4d49333
chore: change identifier to Real Time device Name (SDKCF-6880)
SoumenRautray Feb 23, 2024
5f80643
chore: fix crash on sample app on logging event (SDKCF-6882)
SoumenRautray Feb 23, 2024
6ac8380
improve: Update App name fetching logic for Eventlogger (SDKCF-6915)
SoumenRautray May 3, 2024
43d2b0a
chore: refactor retry mechanism (SDKCF-6920)
SoumenRautray May 9, 2024
bb3319b
improve: add app lifecycle lisenter to ios paltform
SoumenRautray May 21, 2024
dedb314
chore: prepare 4.2.0 release (SDKCF-6928)
Esakkiraja-Pothikannan May 21, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
feat: declare event logger manager and public APIs (SDKCF-6845)
* feat: declare EventLogger public APIs & manager class (SDKCF-6845)
* improve: introduce separate methods to send event critical & warning events (SDKCF-6845)
Esakkiraja-Pothikannan authored and SoumenRautray committed May 21, 2024
commit 9f4835ecf0db97be9d8f863ef2bea33c36c1a92b
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# **Changelog**

## Unreleased
- Features:
- Retrieve Meta-data for Event Logger (SDKCF-6846)
- Event Logger Public API & Manager Class (SDKCF-6845)

#### 4.1.0 (2024-04-08)
- Improve:
- Add Privacy Manifest File (SDKCF-6906)
43 changes: 43 additions & 0 deletions Sources/REventLogger/REvent.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import Foundation

struct REvent: Codable {
let eventType: EventType
let appId: String?
let appName: String?
let appVersion: String?
let osVersion: String
let deviceModel: String
let deviceBrand: String
let deviceName: String
let sourceName: String
let sourceVersion: String
let errorCode: String
let errorMessage: String
let eventVersion: String = "1.0"
let platform: String = "iOS"
var occurrenceCount: Int = 0
var firstOccurrenceOn: Double // unix time
var info: [String: String]?

init(_ type: EventType,
sourceName: String,
sourceVersion: String,
errorCode: String,
errorMessage: String,
info: [String: String]? = nil) {
appId = BundleInfo.appId
appName = BundleInfo.appName
appVersion = BundleInfo.appVersion
osVersion = DeviceInfo.osVersion
deviceModel = DeviceInfo.deviceModel
deviceBrand = DeviceInfo.deviceBrand
deviceName = DeviceInfo.deviceName
firstOccurrenceOn = Date().timeIntervalSince1970
eventType = type
self.sourceName = sourceName
self.sourceVersion = sourceVersion
self.errorCode = errorCode
self.errorMessage = errorMessage
self.info = info
}
}
64 changes: 64 additions & 0 deletions Sources/REventLogger/REventLogger.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
import Foundation

/// Describe the type of the event
public enum EventType: Int, Codable {
case critical, warning
}

struct EventLoggerConfiguration {
let apiKey: String
let apiUrl: String
}

/// Event Logger that sends the custom events to the Event Logger Service
public final class REventLogger {
/// Singleton shared instance of REventLogger
public static let shared = REventLogger()
static var configuration: EventLoggerConfiguration?

private init() { }

/// Function to configure the Event Logger
/// - Parameters:
/// - apiKey: your API Key
/// - apiUrl: a API Endpoint
public static func configure(apiKey: String, apiUrl: String) {
guard configuration != nil else {
return
}
configuration = EventLoggerConfiguration(apiKey: apiKey, apiUrl: apiUrl)
}

/// Logs the critical event
/// This event will be considered as high priority and will be sent immediately
/// - Parameters:
/// - sourceName: Source name of the event e.g App name or SDK name
/// - sourceVersion: Version of the source e.g v1.0.0
/// - errorCode: Error code of the event, like custom error code or HTTP response error code
/// - errorMessage: Description of the error message.
/// - info: Any custom information. It's optional.
public static func sendCriticalEvent(sourceName: String,
sourceVersion: String,
errorCode: String,
errorMessage: String,
info: [String: String]? = nil) {
// Send the event to server
// Save it in the local DB, as warning
}

/// Logs the warning event
/// This event will be considered as low priority and will be sent with batch update.
/// - Parameters:
/// - sourceName: Source name of the event e.g App name or SDK name
/// - sourceVersion: Version of the source e.g v1.0.0
/// - errorCode: Error code of the event, like custom error code or HTTP response error code
/// - errorMessage: Description of the error message.
/// - info: Any custom information. It's optional.
public static func sendWarningEvent(sourceName: String,
sourceVersion: String,
errorCode: String,
errorMessage: String,
info: [String: String]? = nil) {
// Save it in the local DB
}
}
10 changes: 5 additions & 5 deletions Sources/REventLogger/Utilities/DeviceInfo.swift
Original file line number Diff line number Diff line change
@@ -3,23 +3,23 @@ import UIKit
struct DeviceInfo {
static var deviceBundle: Deviceable = UIDevice.current

static var platform: String? {
static var platform: String {
deviceBundle.platform
}

static var osVersion: String? {
static var osVersion: String {
deviceBundle.osVersion
}

static var deviceModel: String? {
static var deviceModel: String {
deviceBundle.deviceModel
}

static var deviceBrand: String? {
static var deviceBrand: String {
deviceBundle.deviceBrand
}

static var deviceName: String? {
static var deviceName: String {
deviceBundle.deviceName
}
}
File renamed without changes.
File renamed without changes.