Skip to content

Commit fad742c

Browse files
committed
add logging for all processes
Signed-off-by: Wouter01 <wouterhennen@gmail.com>
1 parent 5b420bb commit fad742c

1 file changed

Lines changed: 19 additions & 4 deletions

File tree

Sources/LogStream/LogStream.swift

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,6 @@ public enum LogStream {
1616
/// - flags: The options specifying the behavior of the activity stream. Default value is `[.historical, .processOnly]`.
1717
/// - Returns: An `AsyncStream` that emits `LogMessage` objects representing the activity logs.
1818
///
19-
/// The `logs(for:flags:)` method retrieves activity logs for a specific process identified by its PID. It returns an `AsyncStream`
20-
/// that emits `LogMessage` objects representing the activity logs for the process.
21-
///
2219
/// Usage Example:
2320
///
2421
/// ```swift
@@ -27,7 +24,6 @@ public enum LogStream {
2724
///
2825
/// Task {
2926
/// for await log in logStream {
30-
/// // Process the log message
3127
/// print(log)
3228
/// }
3329
/// }
@@ -66,6 +62,25 @@ public enum LogStream {
6662
resumeLog(stream: stream)
6763
}
6864
}
65+
66+
/// Retrieve activity logs for all processes using an asynchronous stream.
67+
///
68+
/// - Parameters:
69+
/// - flags: The options specifying the behavior of the activity stream. Default value is `[.historical, .processOnly]`.
70+
/// - Returns: An `AsyncStream` that emits `LogMessage` objects representing the activity logs.
71+
///
72+
/// Usage Example:
73+
///
74+
/// ```swift
75+
/// Task {
76+
/// for await log in LogStream.logs() {
77+
/// print(log)
78+
/// }
79+
/// }
80+
/// ```
81+
public static func logs(flags: ActivityStreamOptions = [.historical, .processOnly]) -> AsyncStream<LogMessage> {
82+
LogStream.logs(for: -1, flags: flags)
83+
}
6984
}
7085

7186
typealias ActivityStream = os_activity_stream_t

0 commit comments

Comments
 (0)