Files
schihei 7ca5c710ec 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.
2026-11-26 12:33:51 +01:00

32 lines
1.2 KiB
Swift

import os
/// Factory for the app's `os.Logger` and `OSSignposter` instances.
///
/// The subsystem is supplied by the composition root (the app bundle identifier or the CLI
/// subsystem); this module never hard-codes one.
///
/// ## Leaf modules
/// `SprachmittlerOllama` and `SprachmittlerEngines` cannot import Core. When they gain logging,
/// the composition root passes `Logger` values created here into their initializers. A leaf that
/// needs signposts uses an `OSSignposter` with the literal names from ARCHITECTURE §15. Do not
/// add a Core dependency to a leaf module.
public struct Loggers: Sendable {
/// The `os.Logger` subsystem, normally the app bundle identifier.
public let subsystem: String
/// Creates a factory for the given subsystem.
public init(subsystem: String) {
self.subsystem = subsystem
}
/// Returns the logger for one ARCHITECTURE §15 category.
public func logger(_ category: LogCategory) -> Logger {
Logger(subsystem: subsystem, category: category.rawValue)
}
/// Returns the signposter for one ARCHITECTURE §15 category.
public func signposts(_ category: LogCategory) -> Signposts {
Signposts(subsystem: subsystem, category: category)
}
}