feat(m0): complete scaffold, logging and signature checks (T0.2-T0.6)
Add os.Logger categories, OSSignposter wrapper and shortHash helper; enforce exact Debug/Release/install signatures; lint tests; update M0 docs and progress.
This commit is contained in:
1 parent
374085ec2f
commit
7ca5c710ec
17 files changed
+331
-9
No files matched your search
@@ -0,0 +1,29 @@
|
||||
import os
|
||||
|
||||
/// Thin wrapper around `OSSignposter` that uses the names from ARCHITECTURE §15.
|
||||
///
|
||||
/// Leaf modules cannot import Core; the composition root can pass an `OSSignposter` directly to
|
||||
/// them, using the literal names in ARCHITECTURE §15.
|
||||
public struct Signposts: Sendable {
|
||||
private let signposter: OSSignposter
|
||||
|
||||
init(subsystem: String, category: LogCategory) {
|
||||
signposter = OSSignposter(subsystem: subsystem, category: category.rawValue)
|
||||
}
|
||||
|
||||
/// Starts an interval; pair it with ``end(_:)`` on the same task.
|
||||
public func begin(_ name: SignpostName) -> SignpostInterval {
|
||||
let state = signposter.beginInterval(name.literal)
|
||||
return SignpostInterval(name: name, state: state, signposter: signposter)
|
||||
}
|
||||
|
||||
/// Ends an interval started by ``begin(_:)``.
|
||||
public func end(_ interval: SignpostInterval) {
|
||||
interval.signposter.endInterval(interval.name.literal, interval.state)
|
||||
}
|
||||
|
||||
/// Emits a single signpost event.
|
||||
public func event(_ name: SignpostName) {
|
||||
signposter.emitEvent(name.literal)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user