TelnyxLogCollector

public class TelnyxLogCollector

Collects debug logs during a call for inclusion in call reports

Initialization

Public Methods

  • Start capturing logs

    Declaration

    Swift

    public func start()
  • Stop capturing logs

    Declaration

    Swift

    public func stop()
  • Add a log entry if capturing is active and level passes filter

    Declaration

    Swift

    public func addEntry(level: String, message: String, context: [String : Any]? = nil)

    Parameters

    level

    Log level (“debug”, “info”, “warn”, “error”)

    message

    Log message

    context

    Optional context dictionary

  • Get all collected logs (non-destructive)

    Declaration

    Swift

    public func getLogs() -> [LogEntry]

    Return Value

    Array of log entries

  • Atomically returns all logs and clears the buffer. Used by intermediate flushes so logs are not re-sent.

    Declaration

    Swift

    public func drain() -> [LogEntry]

    Return Value

    Array of log entries that were in the buffer

  • Get the number of collected logs

    Declaration

    Swift

    public func getLogCount() -> Int

    Return Value

    Number of log entries in buffer

  • Clear the buffer

    Declaration

    Swift

    public func clear()
  • Check if collector is currently capturing

    Declaration

    Swift

    public func isActive() -> Bool

    Return Value

    True if capturing, false otherwise

  • Check if collector is enabled

    Declaration

    Swift

    public func isEnabled() -> Bool

    Return Value

    True if enabled, false otherwise