Repository navigation
SwiftMoLogger 4.2.0
Runtime control and better evidence: per-tag log levels you can drive from remote config, Swift task names on every entry, the system log in bug reports, and recorded logs attached to failing Swift Testing tests. Additive; no API changes.
Added
- Task names.
LogEntry.taskNamerecords the name of the Swift task that logged the entry (Task(name:), SE-0469; Swift 6.2 with iOS 26 / macOS 26 and later). The console, the Hub andswiftmologger-inspectorshow it next to the thread, OTLP sendsswift.task.nameand Datadogtask. It's optional, so files written by 4.0 still decode, and Swift 6.1 builds leave itnil. (#15) - Per-tag minimum levels.
registry.setMinimumLevel(.trace, for: .Data.database)turns on verbose logs for one area, and.errorquiets a noisy one, without changing the level everywhere. Overrides match a tag domain and everything below it, the most specific wins, andregistry.levelOverrides = LevelOverrides(levels)replaces them all at once, for example from remote config (LogLevel(name:)parses level names). Filtered calls still return before the message is built. (#18) - System log in bug reports.
BugReporter(…, systemLog: SystemLogOptions(window: 600))adds the app's recent unified-log entries (os_logandLogger, where Apple frameworks and SDKs log) assystem-log.txt. Entries go through the redactor, the file keeps the newest entries within 1 MB, and an unreadable log is noted instead of failing the report.SystemLogSourcelets tests inject entries. (#20) - Recorded logs as test attachments.
RecordingLogEngine.attach(named:)adds the recorded entries to the current Swift Testing test as a text file, one line per entry with time, level, tag, metadata and source location. Call it in adefer, and a failing test's report shows what was logged. Requires Swift 6.2 or later; the package still builds with Swift 6.1, without the method. (#14)
Fixed
- Two bug reports generated in the same second no longer share a directory, where one could overwrite or delete the other's files. Report directories now end in a short unique suffix.
Install
.package(url: "https://github.com/MoElnaggar14/SwiftMoLogger.git", from: "4.2.0")