LogStream

1.2.1

Wouter01/LogStream

What's New

v1.2.1

2023-05-22T15:53:37Z
  • LogMessage conforms to Hashable

LogStream

This package provides some utilities to capture logs of other processes. This can be useful when working with extensions using ExtensionKit.

The logs captured are the same ones visible in Console.app.

Usage

Capturing logs for one process:

// Specify the process identifier of which to capture logs.
let pid: pid_t = ...
let logStream = LogStream.logs(for: pid)

Task {
    for await log in logStream {
        print("\(log.process) says: \(log.message)")
    }
}

Logs of multiple processes can also be captures with another initializer:

public static func logs(for processIDs: [pid_t], flags: ActivityStreamOptions) -> AsyncStream<LogMessage>

To capture logs of all processes, use the following initializer:

public static func logs(flags: ActivityStreamOptions) -> AsyncStream<LogMessage>

Description

  • Swift Tools 5.8.0
View More Packages from this Author

Dependencies

  • None
Last updated: Mon Apr 29 2024 14:23:23 GMT-0900 (Hawaii-Aleutian Daylight Time)