Publisher

extension Publisher
  • Publisher which logs the failure value of the preceding publisher

    Declaration

    Swift

    public func logError(
        logCategory: KeyPath<LogCategories, LogCategory> = \.default,
        functionName: StaticString = #function,
        fileName: StaticString = #file,
        lineNumber: Int = #line,
        _ message: @escaping (Self.Failure) -> Any? = { (output: Self.Failure) in return output }
    ) -> AnyPublisher<Self.Output, Self.Failure>

    Parameters

    logCategory

    Category of the log message

    functionName

    Name of the function in which the message is logged

    fileName

    Name of the file in which the message is logged

    lineNumber

    Line number in which the message is logged

    message

    Message to log

    Return Value

    Returns an AnyPublisher with AnyPublisher<Self.Output, Self.Failure>

  • Publisher which logs the ouput value of the preceding publisher

    Declaration

    Swift

    public func logValue(logType: LogType = .verbose,
                         logCategory: KeyPath<LogCategories, LogCategory> = \.default,
                         functionName: StaticString = #function,
                         fileName: StaticString = #file,
                         lineNumber: Int = #line,
                         _ message: @escaping (Self.Output) -> Any? = { (output: Self.Output) in return output }
    ) -> AnyPublisher<Self.Output, Self.Failure>

    Parameters

    logType

    Type of the value log message

    logCategory

    Category of the log message

    functionName

    Name of the function in which the message is logged

    fileName

    Name of the file in which the message is logged

    lineNumber

    Line number in which the message is logged

    message

    Message to log

    Return Value

    Returns an AnyPublisher with AnyPublisher<Self.Output, Self.Failure>

  • Publisher which both logs the Self.Failure value and the Self.Output value of the preceding publisher

    Declaration

    Swift

    public func log(
        messageValue: @escaping (Self.Output) -> Any? = { (output: Self.Output) in return output },
        messageError: @escaping (Self.Failure) -> Any? = { (output: Self.Failure) in return output },
        valuelogType: LogType = .verbose,
        logCategory: KeyPath<LogCategories, LogCategory> = \.default,
        functionName: StaticString = #function,
        fileName: StaticString = #file,
        lineNumber: Int = #line)
        -> AnyPublisher<Self.Output, Self.Failure>

    Parameters

    messageValue

    Self.Output message to log

    messageError

    Self.Failure message to log

    valuelogType

    Type of the Self.Output log message

    logCategory

    Category of the both log messages

    functionName

    Name of the function in which the message is logged

    fileName

    Name of the file in which the message is logged

    lineNumber

    Line number in which the message is logged

    Return Value

    Returns an AnyPublisher with AnyPublisher<Self.Output, Self.Failure>