Skip to content

Commit

Permalink
Allow custom OSLog with ComposableRequest (#28)
Browse files Browse the repository at this point in the history
  • Loading branch information
vsanthanam committed Jun 24, 2021
1 parent d6e6484 commit 48af98b
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions Sources/Ombi/Core/ComposableRequest.swift
Expand Up @@ -483,6 +483,22 @@ public struct ComposableRequest<RequestBody, ResponseBody, ResponseError>: Reque
/// - retries: The number of retries
/// - sla: The SLA to use before timing out
/// - Returns: A publisher to observe request responses
public func send(on host: String,
retries: Int = 0,
sla: TimeInterval = 120) -> AnyPublisher<Response, Failure> {
send(on: host,
retries: retries,
sla: .seconds(sla),
using: DispatchQueue.global())
}

/// Send this request on the main thread
/// - Parameters:
/// - host: The host
/// - retries: The number of retries
/// - sla: The SLA to use before timing out
/// - log: The log used to write network request info.
/// - Returns: A publisher to observe request responses
public func send(on host: String,
retries: Int = 0,
sla: TimeInterval = 120,
Expand All @@ -501,6 +517,25 @@ public struct ComposableRequest<RequestBody, ResponseBody, ResponseError>: Reque
/// - sla: The SLA to use before timing out
/// - scheduler: The scheduler to use
/// - Returns: A publisher to observe request responses
public func send<S>(on host: String,
retries: Int = 0,
sla: S.SchedulerTimeType.Stride = .seconds(120),
using scheduler: S) -> AnyPublisher<Response, Failure> where S: Scheduler {
let manager = RequestManager(host: host)
return manager.makeRequest(self,
retries: retries,
sla: sla,
on: scheduler)
}

/// Send this request
/// - Parameters:
/// - host: The host
/// - retries: The number of retries
/// - sla: The SLA to use before timing out
/// - scheduler: The scheduler to use
/// - log: The log used to write network request info.
/// - Returns: A publisher to observe request responses
public func send<S>(on host: String,
retries: Int = 0,
sla: S.SchedulerTimeType.Stride = .seconds(120),
Expand Down

0 comments on commit 48af98b

Please sign in to comment.