Content-Length: 337569 | pFad | http://github.com/muxinc/mux-player-swift/pull/30/files

D5 chore: emit SDK diagnostics into unified logging system by andrewjl-mux · Pull Request #30 · muxinc/mux-player-swift · GitHub
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: emit SDK diagnostics into unified logging system #30

Merged
merged 1 commit into from
Feb 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
25 changes: 25 additions & 0 deletions Sources/MuxPlayerSwift/GlobalLifecycle/PlayerSDK.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
//

import Foundation
import os

// internal class to manage dependency injection
class PlayerSDK {
Expand All @@ -11,10 +12,34 @@ class PlayerSDK {

let monitor: Monitor

let diagnosticsLogger: Logger

let abrLogger: Logger

let reverseProxyServer: ReverseProxyServer

init() {
self.monitor = Monitor()
self.diagnosticsLogger = Logger(
OSLog(
subsystem: "com.mux.player",
category: "Diagnostics"
)
)

#if DEBUG
self.abrLogger = Logger(
OSLog(
subsystem: "com.mux.player",
category: "ABR"
)
)
#else
self.abrLogger = Logger(
.disabled
)
#endif

self.reverseProxyServer = ReverseProxyServer()

self.reverseProxyServer.start()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
//

import Foundation
import os

import GCDWebServer

Expand All @@ -11,7 +12,10 @@
class EventRecorder {

func didRecord(event: ReverseProxyEvent) {
print("RPS - \(Date()) - \(event.description)")

PlayerSDK.shared
.diagnosticsLogger
.debug("RPS - \(Date()) - \(event.description)")
}

}
Expand Down Expand Up @@ -193,7 +197,7 @@

guard let data = data,
let response = response,
let mimeType = response.mimeType

Check warning on line 200 in Sources/MuxPlayerSwift/ReverseProxyServer/ReverseProxyServer.swift

View workflow job for this annotation

GitHub Actions / Run Unit Tests

immutable value 'mimeType' was never used; consider replacing with '_' or removing it
else {
return completion(GCDWebServerErrorResponse(statusCode: 500))
}
Expand Down Expand Up @@ -263,7 +267,7 @@
components?.queryItems = nil
components?.host = "stream.mux.com"

var strippedRequest = URLRequest(url: components!.url!)

Check warning on line 270 in Sources/MuxPlayerSwift/ReverseProxyServer/ReverseProxyServer.swift

View workflow job for this annotation

GitHub Actions / Run Unit Tests

variable 'strippedRequest' was never mutated; consider changing to 'let' constant

if let cachedResponse = self.segmentCache.cachedResponse(
for: strippedRequest
Expand Down
Loading








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/muxinc/mux-player-swift/pull/30/files

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy